[PATCH 25/57][Arm][GAS] Add support for MVE instruction: vmvn, vqabs and vqneg
[binutils-gdb.git] / gold / tls.h
blob3821dd490df7995f31fa4b0015191f505743db67
1 // tls.h -- Thread-Local Storage utility routines for gold -*- C++ -*-
3 // Copyright (C) 2006-2019 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.
23 #ifndef GOLD_TLS_H
24 #define GOLD_TLS_H
26 #include "elfcpp.h"
27 #include "reloc.h"
29 namespace gold
32 namespace tls
35 // This is used for relocations that can be converted to a different,
36 // more efficient type of relocation.
38 enum Tls_optimization
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>
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)
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"));
62 // Check the validity of a TLS relocation. This is like assert.
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)
71 if (!valid)
72 gold_error_at_location(relinfo, relnum, rel_offset,
73 _("TLS relocation against invalid instruction"));
77 } // End namespace tls.
79 } // End namespace gold.
81 #endif // !defined(GOLD_TLS_H)