OpenCores
URL https://opencores.org/ocsvn/open8_urisc/open8_urisc/trunk

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [gold/] [tls.h] - Blame information for rev 158

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 khays
// tls.h -- Thread-Local Storage utility routines for gold   -*- C++ -*-
2
 
3
// Copyright 2006, 2007, 2008 Free Software Foundation, Inc.
4
// Written by Ian Lance Taylor <iant@google.com>.
5
 
6
// This file is part of gold.
7
 
8
// This program is free software; you can redistribute it and/or modify
9
// it under the terms of the GNU General Public License as published by
10
// the Free Software Foundation; either version 3 of the License, or
11
// (at your option) any later version.
12
 
13
// This program is distributed in the hope that it will be useful,
14
// but WITHOUT ANY WARRANTY; without even the implied warranty of
15
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
// GNU General Public License for more details.
17
 
18
// You should have received a copy of the GNU General Public License
19
// along with this program; if not, write to the Free Software
20
// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21
// MA 02110-1301, USA.
22
 
23
#ifndef GOLD_TLS_H
24
#define GOLD_TLS_H
25
 
26
#include "elfcpp.h"
27
#include "reloc.h"
28
 
29
namespace gold
30
{
31
 
32
namespace tls
33
{
34
 
35
// This is used for relocations that can be converted to a different,
36
// more efficient type of relocation.
37
 
38
enum Tls_optimization
39
{
40
  TLSOPT_NONE,    // Can not convert this relocation to a more efficient one.
41
  TLSOPT_TO_LD,   // Can convert General Dynamic to Local Dynamic.
42
  TLSOPT_TO_LE,   // Can convert GD or LD to Local-Exec.
43
  TLSOPT_TO_IE,   // Can convert GD or LD or LE to Initial-Exec.
44
};
45
 
46
// Check the range for a TLS relocation.  This is inlined for efficiency.
47
 
48
template<int size, bool big_endian>
49
inline void
50
check_range(const Relocate_info<size, big_endian>* relinfo,
51
            size_t relnum,
52
            typename elfcpp::Elf_types<size>::Elf_Addr rel_offset,
53
            section_size_type view_size, int off)
54
{
55
  typename elfcpp::Elf_types<size>::Elf_Addr offset = rel_offset + off;
56
  // Elf_Addr is unsigned, so this also tests for signed offset < 0.
57
  if (offset > view_size)
58
    gold_error_at_location(relinfo, relnum, rel_offset,
59
                           _("TLS relocation out of range"));
60
}
61
 
62
// Check the validity of a TLS relocation.  This is like assert.
63
 
64
template<int size, bool big_endian>
65
inline void
66
check_tls(const Relocate_info<size, big_endian>* relinfo,
67
          size_t relnum,
68
          typename elfcpp::Elf_types<size>::Elf_Addr rel_offset,
69
          bool valid)
70
{
71
  if (!valid)
72
    gold_error_at_location(relinfo, relnum, rel_offset,
73
                           _("TLS relocation against invalid instruction"));
74
}
75
 
76
 
77
} // End namespace tls.
78
 
79
} // End namespace gold.
80
 
81
#endif // !defined(GOLD_TLS_H)

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.