1 // tls.h -- Thread-Local Storage utility routines for gold -*- C++ -*-
3 // Copyright 2006, 2007 Free Software Foundation, Inc.
4 // Written by Ian Lance Taylor <iant@google.com>.
6 // This file is part of gold.
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.
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.
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.
35 // This is used for relocations that can be converted to a different,
36 // more efficient type of relocation.
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.
46 // Check the range for a TLS relocation. This is inlined for efficiency.
48 template<int size, bool big_endian>
50 check_range(const Relocate_info<size, big_endian>* relinfo,
52 typename elfcpp::Elf_types<size>::Elf_Addr rel_offset,
53 off_t view_size, off_t off)
55 off_t offset = rel_offset + off;
56 if (offset < 0 || offset > view_size)
57 gold_error_at_location(relinfo, relnum, rel_offset,
58 _("TLS relocation out of range"));
61 // Check the validity of a TLS relocation. This is like assert.
63 template<int size, bool big_endian>
65 check_tls(const Relocate_info<size, big_endian>* relinfo,
67 typename elfcpp::Elf_types<size>::Elf_Addr rel_offset,
71 gold_error_at_location(relinfo, relnum, rel_offset,
72 _("TLS relocation against invalid instruction"));
76 } // End namespace tls.
78 } // End namespace gold.
80 #endif // !defined(GOLD_TLS_H)