Home | History | Annotate | Line # | Download | only in elf
      1       1.1  christos /* AArch64 ELF support for BFD.
      2       1.1  christos 
      3  1.1.1.10  christos    Copyright (C) 2009-2026 Free Software Foundation, Inc.
      4       1.1  christos    Contributed by ARM Ltd.
      5       1.1  christos 
      6       1.1  christos    This file is part of GNU Binutils.
      7       1.1  christos 
      8       1.1  christos    This program is free software; you can redistribute it and/or modify
      9       1.1  christos    it under the terms of the GNU General Public License as published by
     10       1.1  christos    the Free Software Foundation; either version 3 of the license, or
     11       1.1  christos    (at your option) any later version.
     12       1.1  christos 
     13       1.1  christos    This program is distributed in the hope that it will be useful,
     14       1.1  christos    but WITHOUT ANY WARRANTY; without even the implied warranty of
     15       1.1  christos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16       1.1  christos    GNU General Public License for more details.
     17       1.1  christos 
     18       1.1  christos    You should have received a copy of the GNU General Public License
     19       1.1  christos    along with this program; see the file COPYING3. If not,
     20       1.1  christos    see <http://www.gnu.org/licenses/>.  */
     21       1.1  christos 
     22       1.1  christos #ifndef _ELF_AARCH64_H
     23       1.1  christos #define _ELF_AARCH64_H
     24       1.1  christos 
     25       1.1  christos #include "elf/reloc-macros.h"
     26       1.1  christos 
     27       1.1  christos /* Processor specific program header types.  */
     28       1.1  christos #define PT_AARCH64_ARCHEXT	(PT_LOPROC + 0)
     29       1.1  christos 
     30   1.1.1.8  christos /* MTE memory tag segment type.  */
     31   1.1.1.8  christos #define PT_AARCH64_MEMTAG_MTE     (PT_LOPROC + 0x2)
     32   1.1.1.8  christos 
     33   1.1.1.9  christos /* Name of the ELF section holding the attributes.  */
     34   1.1.1.9  christos #define SEC_AARCH64_ATTRIBUTES	".ARM.attributes"
     35       1.1  christos /* Additional section types.  */
     36   1.1.1.9  christos /* Section holds attributes.  */
     37   1.1.1.9  christos #define SHT_AARCH64_ATTRIBUTES	(SHT_LOPROC + 3)
     38   1.1.1.9  christos /* Special aarch64-specific section for MTE support, as described in:
     39   1.1.1.9  christos    https://github.com/ARM-software/abi-aa/blob/main/pauthabielf64/pauthabielf64.rst#section-types  */
     40   1.1.1.9  christos #define SHT_AARCH64_AUTH_RELR   (SHT_LOPROC + 4)
     41   1.1.1.9  christos /* Special aarch64-specific sections for MTE support, as described in:
     42   1.1.1.9  christos    https://github.com/ARM-software/abi-aa/blob/main/memtagabielf64/memtagabielf64.rst#7section-types  */
     43   1.1.1.9  christos #define SHT_AARCH64_MEMTAG_GLOBALS_STATIC  (SHT_LOPROC + 7)
     44   1.1.1.9  christos #define SHT_AARCH64_MEMTAG_GLOBALS_DYNAMIC (SHT_LOPROC + 8)
     45       1.1  christos 
     46       1.1  christos /* AArch64-specific values for sh_flags.  */
     47       1.1  christos #define SHF_ENTRYSECT		0x10000000   /* Section contains an
     48       1.1  christos 						entry point.  */
     49       1.1  christos #define SHF_COMDEF		0x80000000   /* Section may be multiply defined
     50       1.1  christos 						in the input to a link step.  */
     51   1.1.1.6  christos /* Processor specific dynamic array tags.  */
     52   1.1.1.6  christos #define DT_AARCH64_BTI_PLT	(DT_LOPROC + 1)
     53   1.1.1.6  christos #define DT_AARCH64_PAC_PLT	(DT_LOPROC + 3)
     54   1.1.1.6  christos #define DT_AARCH64_VARIANT_PCS	(DT_LOPROC + 5)
     55   1.1.1.9  christos #define DT_AARCH64_MEMTAG_MODE	(DT_LOPROC + 9)
     56   1.1.1.9  christos #define DT_AARCH64_MEMTAG_STACK (DT_LOPROC + 12)
     57   1.1.1.6  christos 
     58   1.1.1.6  christos /* AArch64-specific values for st_other.  */
     59   1.1.1.6  christos #define STO_AARCH64_VARIANT_PCS	0x80  /* Symbol may follow different call
     60   1.1.1.6  christos 					 convention from the base PCS.  */
     61       1.1  christos 
     62  1.1.1.10  christos /* Tags used in aeabi_feature_and_bits subsection.
     63  1.1.1.10  christos    See document 'Build Attributes for the Arm 64-bit Architecture (AArch64)
     64  1.1.1.10  christos    7.4 aeabi_feature_and_bits subsection'.  */
     65  1.1.1.10  christos typedef enum Tag_Feature_Set {
     66  1.1.1.10  christos   Tag_Feature_BTI = 0,
     67  1.1.1.10  christos   Tag_Feature_PAC = 1,
     68  1.1.1.10  christos   Tag_Feature_GCS = 2,
     69  1.1.1.10  christos } Tag_Feature_Set;
     70  1.1.1.10  christos 
     71  1.1.1.10  christos /* Tags used in aeabi_pauthabi subsection.
     72  1.1.1.10  christos    See document 'Build Attributes for the Arm 64-bit Architecture (AArch64)
     73  1.1.1.10  christos    7.5 Pointer Authentication Signing Schema.  */
     74  1.1.1.10  christos typedef enum Tag_PAuth_Info {
     75  1.1.1.10  christos   Tag_PAuth_Platform = 1,
     76  1.1.1.10  christos   Tag_PAuth_Schema = 2,
     77  1.1.1.10  christos } Tag_PAuth_Info;
     78  1.1.1.10  christos 
     79       1.1  christos /* Relocation types.  */
     80       1.1  christos 
     81       1.1  christos START_RELOC_NUMBERS (elf_aarch64_reloc_type)
     82       1.1  christos 
     83   1.1.1.2  christos /* Null relocations.  */
     84       1.1  christos RELOC_NUMBER (R_AARCH64_NONE, 0) /* No reloc */
     85       1.1  christos 
     86   1.1.1.2  christos /* Basic data relocations.  */
     87   1.1.1.2  christos 
     88   1.1.1.2  christos /* .word:  (S+A) */
     89   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_ABS32, 1)
     90   1.1.1.2  christos 
     91   1.1.1.2  christos /* .half: (S+A) */
     92   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_ABS16, 2)
     93   1.1.1.2  christos 
     94   1.1.1.2  christos /* .word: (S+A-P) */
     95   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_PREL32, 3)
     96   1.1.1.2  christos 
     97   1.1.1.2  christos /* .half:  (S+A-P) */
     98   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_PREL16, 4)
     99   1.1.1.2  christos 
    100   1.1.1.2  christos /* Group relocations to create a 16, 32, 48 or 64 bit
    101   1.1.1.2  christos    unsigned data or abs address inline.  */
    102   1.1.1.2  christos 
    103   1.1.1.2  christos /* MOV[ZK]:   ((S+A) >>  0) & 0xffff */
    104   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_MOVW_UABS_G0, 5)
    105   1.1.1.2  christos 
    106   1.1.1.2  christos /* MOV[ZK]:   ((S+A) >>  0) & 0xffff */
    107   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_MOVW_UABS_G0_NC, 6)
    108   1.1.1.2  christos 
    109   1.1.1.2  christos /* MOV[ZK]:   ((S+A) >> 16) & 0xffff */
    110   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_MOVW_UABS_G1, 7)
    111   1.1.1.2  christos 
    112   1.1.1.2  christos /* Group relocations to create high part of a 16, 32, 48 or 64 bit
    113   1.1.1.2  christos    signed data or abs address inline. Will change instruction
    114   1.1.1.2  christos    to MOVN or MOVZ depending on sign of calculated value.  */
    115   1.1.1.2  christos 
    116   1.1.1.2  christos /* MOV[ZN]:   ((S+A) >>  0) & 0xffff */
    117   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_MOVW_SABS_G0, 8)
    118   1.1.1.2  christos 
    119   1.1.1.2  christos /* Relocations to generate 19, 21 and 33 bit PC-relative load/store
    120   1.1.1.2  christos    addresses: PG(x) is (x & ~0xfff).  */
    121   1.1.1.2  christos 
    122   1.1.1.2  christos /* LD-lit: ((S+A-P) >> 2) & 0x7ffff */
    123   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_LD_PREL_LO19, 9)
    124   1.1.1.2  christos 
    125   1.1.1.2  christos /* ADR:    (S+A-P) & 0x1fffff */
    126   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_ADR_PREL_LO21, 10)
    127   1.1.1.2  christos 
    128   1.1.1.2  christos /* ADRH:   ((PG(S+A)-PG(P)) >> 12) & 0x1fffff */
    129   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_ADR_PREL_PG_HI21, 11)
    130   1.1.1.2  christos 
    131   1.1.1.2  christos /* ADD:    (S+A) & 0xfff */
    132   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_ADD_ABS_LO12_NC, 12)
    133   1.1.1.2  christos 
    134   1.1.1.2  christos /* LD/ST8: (S+A) & 0xfff */
    135   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_LDST8_ABS_LO12_NC, 13)
    136   1.1.1.2  christos 
    137   1.1.1.2  christos /* LD/ST16: (S+A) & 0xffe */
    138   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_LDST16_ABS_LO12_NC, 14)
    139   1.1.1.2  christos 
    140   1.1.1.2  christos /* LD/ST32: (S+A) & 0xffc */
    141   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_LDST32_ABS_LO12_NC, 15)
    142   1.1.1.2  christos 
    143   1.1.1.2  christos /* LD/ST64: (S+A) & 0xff8 */
    144   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_LDST64_ABS_LO12_NC, 16)
    145   1.1.1.2  christos 
    146   1.1.1.2  christos /* LD/ST128: (S+A) & 0xff0 */
    147   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_LDST128_ABS_LO12_NC, 17)
    148   1.1.1.2  christos 
    149   1.1.1.2  christos /* Relocations for control-flow instructions.  */
    150   1.1.1.2  christos 
    151   1.1.1.2  christos /* TBZ/NZ: ((S+A-P) >> 2) & 0x3fff.  */
    152   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_TSTBR14, 18)
    153   1.1.1.2  christos 
    154   1.1.1.2  christos /* B.cond: ((S+A-P) >> 2) & 0x7ffff.  */
    155   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_CONDBR19, 19)
    156   1.1.1.2  christos 
    157   1.1.1.2  christos /* B:      ((S+A-P) >> 2) & 0x3ffffff.  */
    158   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_JUMP26, 20)
    159   1.1.1.2  christos 
    160   1.1.1.2  christos /* BL:     ((S+A-P) >> 2) & 0x3ffffff.  */
    161   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_CALL26, 21)
    162   1.1.1.2  christos 
    163   1.1.1.6  christos /* Group relocations to create a 16 or 32 bit PC-relative offset inline.  */
    164   1.1.1.6  christos RELOC_NUMBER (R_AARCH64_P32_MOVW_PREL_G0, 22)
    165   1.1.1.6  christos RELOC_NUMBER (R_AARCH64_P32_MOVW_PREL_G0_NC, 23)
    166   1.1.1.6  christos RELOC_NUMBER (R_AARCH64_P32_MOVW_PREL_G1, 24)
    167   1.1.1.2  christos 
    168   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_GOT_LD_PREL19, 25)
    169   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_ADR_GOT_PAGE, 26)
    170   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_LD32_GOT_LO12_NC, 27)
    171   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_LD32_GOTPAGE_LO14, 28)
    172   1.1.1.2  christos 
    173   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_TLSGD_ADR_PREL21, 80)
    174   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_TLSGD_ADR_PAGE21, 81)
    175   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_TLSGD_ADD_LO12_NC, 82)
    176   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_TLSLD_ADR_PREL21, 83)
    177   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_TLSLD_ADR_PAGE21, 84)
    178   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_TLSLD_ADD_LO12_NC, 85)
    179   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_TLSLD_MOVW_DTPREL_G1, 87)
    180   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_TLSLD_MOVW_DTPREL_G0, 88)
    181   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_TLSLD_MOVW_DTPREL_G0_NC, 89)
    182   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_TLSLD_ADD_DTPREL_HI12, 90)
    183   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_TLSLD_ADD_DTPREL_LO12, 91)
    184   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_TLSLD_ADD_DTPREL_LO12_NC, 92)
    185   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_TLSIE_ADR_GOTTPREL_PAGE21, 103)
    186   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_TLSIE_LD32_GOTTPREL_LO12_NC, 104)
    187   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_TLSIE_LD_GOTTPREL_PREL19, 105)
    188   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_TLSLE_MOVW_TPREL_G1, 106)
    189   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_TLSLE_MOVW_TPREL_G0, 107)
    190   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_TLSLE_MOVW_TPREL_G0_NC, 108)
    191   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_TLSLE_ADD_TPREL_HI12, 109)
    192   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_TLSLE_ADD_TPREL_LO12, 110)
    193   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_TLSLE_ADD_TPREL_LO12_NC, 111)
    194   1.1.1.5  christos RELOC_NUMBER (R_AARCH64_P32_TLSLE_LDST8_TPREL_LO12, 112)
    195   1.1.1.5  christos RELOC_NUMBER (R_AARCH64_P32_TLSLE_LDST8_TPREL_LO12_NC, 113)
    196   1.1.1.5  christos RELOC_NUMBER (R_AARCH64_P32_TLSLE_LDST16_TPREL_LO12, 114)
    197   1.1.1.5  christos RELOC_NUMBER (R_AARCH64_P32_TLSLE_LDST16_TPREL_LO12_NC, 115)
    198   1.1.1.5  christos RELOC_NUMBER (R_AARCH64_P32_TLSLE_LDST32_TPREL_LO12, 116)
    199   1.1.1.5  christos RELOC_NUMBER (R_AARCH64_P32_TLSLE_LDST32_TPREL_LO12_NC, 117)
    200   1.1.1.5  christos RELOC_NUMBER (R_AARCH64_P32_TLSLE_LDST64_TPREL_LO12, 118)
    201   1.1.1.5  christos RELOC_NUMBER (R_AARCH64_P32_TLSLE_LDST64_TPREL_LO12_NC, 119)
    202   1.1.1.2  christos 
    203   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_TLSDESC_LD_PREL19, 122)
    204   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_TLSDESC_ADR_PREL21, 123)
    205   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_TLSDESC_ADR_PAGE21, 124)
    206   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_TLSDESC_LD32_LO12_NC, 125)
    207   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_TLSDESC_ADD_LO12_NC, 126)
    208   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_TLSDESC_CALL, 127)
    209   1.1.1.2  christos 
    210   1.1.1.2  christos /* Dynamic relocations */
    211   1.1.1.2  christos 
    212   1.1.1.2  christos /* Copy symbol at runtime.  */
    213   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_COPY, 180)
    214   1.1.1.2  christos 
    215   1.1.1.2  christos /* Create GOT entry.  */
    216   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_GLOB_DAT, 181)
    217   1.1.1.2  christos 
    218   1.1.1.2  christos  /* Create PLT entry.  */
    219   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_JUMP_SLOT, 182)
    220   1.1.1.2  christos 
    221   1.1.1.2  christos /* Adjust by program base.  */
    222   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_RELATIVE, 183)
    223   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_TLS_DTPMOD, 184)
    224   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_TLS_DTPREL, 185)
    225   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_TLS_TPREL, 186)
    226   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_TLSDESC, 187)
    227   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_P32_IRELATIVE, 188)
    228       1.1  christos 
    229       1.1  christos RELOC_NUMBER (R_AARCH64_NULL, 256) /* No reloc */
    230       1.1  christos 
    231   1.1.1.2  christos /* Basic data relocations.  */
    232       1.1  christos 
    233       1.1  christos /* .xword: (S+A) */
    234       1.1  christos RELOC_NUMBER (R_AARCH64_ABS64, 257)
    235       1.1  christos 
    236       1.1  christos /* .word:  (S+A) */
    237       1.1  christos RELOC_NUMBER (R_AARCH64_ABS32, 258)
    238       1.1  christos 
    239       1.1  christos /* .half: (S+A) */
    240       1.1  christos RELOC_NUMBER (R_AARCH64_ABS16, 259)
    241       1.1  christos 
    242       1.1  christos /* .xword: (S+A-P) */
    243       1.1  christos RELOC_NUMBER (R_AARCH64_PREL64, 260)
    244       1.1  christos 
    245       1.1  christos /* .word: (S+A-P) */
    246       1.1  christos RELOC_NUMBER (R_AARCH64_PREL32, 261)
    247       1.1  christos 
    248       1.1  christos /* .half:  (S+A-P) */
    249       1.1  christos RELOC_NUMBER (R_AARCH64_PREL16, 262)
    250       1.1  christos 
    251       1.1  christos /* Group relocations to create a 16, 32, 48 or 64 bit
    252   1.1.1.2  christos    unsigned data or abs address inline.  */
    253       1.1  christos 
    254       1.1  christos /* MOV[ZK]:   ((S+A) >>  0) & 0xffff */
    255       1.1  christos RELOC_NUMBER (R_AARCH64_MOVW_UABS_G0,		263)
    256       1.1  christos 
    257       1.1  christos /* MOV[ZK]:   ((S+A) >>  0) & 0xffff */
    258       1.1  christos RELOC_NUMBER (R_AARCH64_MOVW_UABS_G0_NC, 264)
    259       1.1  christos 
    260       1.1  christos /* MOV[ZK]:   ((S+A) >> 16) & 0xffff */
    261       1.1  christos RELOC_NUMBER (R_AARCH64_MOVW_UABS_G1, 265)
    262       1.1  christos 
    263       1.1  christos /* MOV[ZK]:   ((S+A) >> 16) & 0xffff */
    264       1.1  christos RELOC_NUMBER (R_AARCH64_MOVW_UABS_G1_NC, 266)
    265       1.1  christos 
    266       1.1  christos /* MOV[ZK]:   ((S+A) >> 32) & 0xffff */
    267       1.1  christos RELOC_NUMBER (R_AARCH64_MOVW_UABS_G2, 267)
    268       1.1  christos 
    269       1.1  christos /* MOV[ZK]:   ((S+A) >> 32) & 0xffff */
    270       1.1  christos RELOC_NUMBER (R_AARCH64_MOVW_UABS_G2_NC, 268)
    271       1.1  christos 
    272       1.1  christos /* MOV[ZK]:   ((S+A) >> 48) & 0xffff */
    273       1.1  christos RELOC_NUMBER (R_AARCH64_MOVW_UABS_G3, 269)
    274       1.1  christos 
    275       1.1  christos /* Group relocations to create high part of a 16, 32, 48 or 64 bit
    276       1.1  christos    signed data or abs address inline. Will change instruction
    277   1.1.1.2  christos    to MOVN or MOVZ depending on sign of calculated value.  */
    278       1.1  christos 
    279       1.1  christos /* MOV[ZN]:   ((S+A) >>  0) & 0xffff */
    280       1.1  christos RELOC_NUMBER (R_AARCH64_MOVW_SABS_G0, 270)
    281       1.1  christos 
    282       1.1  christos /* MOV[ZN]:   ((S+A) >> 16) & 0xffff */
    283       1.1  christos RELOC_NUMBER (R_AARCH64_MOVW_SABS_G1, 271)
    284       1.1  christos 
    285       1.1  christos /* MOV[ZN]:   ((S+A) >> 32) & 0xffff */
    286       1.1  christos RELOC_NUMBER (R_AARCH64_MOVW_SABS_G2, 272)
    287       1.1  christos 
    288       1.1  christos /* Relocations to generate 19, 21 and 33 bit PC-relative load/store
    289   1.1.1.2  christos    addresses: PG(x) is (x & ~0xfff).  */
    290       1.1  christos 
    291       1.1  christos /* LD-lit: ((S+A-P) >> 2) & 0x7ffff */
    292       1.1  christos RELOC_NUMBER (R_AARCH64_LD_PREL_LO19, 273)
    293       1.1  christos 
    294       1.1  christos /* ADR:    (S+A-P) & 0x1fffff */
    295       1.1  christos RELOC_NUMBER (R_AARCH64_ADR_PREL_LO21, 274)
    296       1.1  christos 
    297       1.1  christos /* ADRH:   ((PG(S+A)-PG(P)) >> 12) & 0x1fffff */
    298       1.1  christos RELOC_NUMBER (R_AARCH64_ADR_PREL_PG_HI21, 275)
    299       1.1  christos 
    300       1.1  christos /* ADRH:   ((PG(S+A)-PG(P)) >> 12) & 0x1fffff */
    301       1.1  christos RELOC_NUMBER (R_AARCH64_ADR_PREL_PG_HI21_NC, 276)
    302       1.1  christos 
    303       1.1  christos /* ADD:    (S+A) & 0xfff */
    304       1.1  christos RELOC_NUMBER (R_AARCH64_ADD_ABS_LO12_NC, 277)
    305       1.1  christos 
    306       1.1  christos /* LD/ST8: (S+A) & 0xfff */
    307       1.1  christos RELOC_NUMBER (R_AARCH64_LDST8_ABS_LO12_NC, 278)
    308       1.1  christos 
    309   1.1.1.2  christos /* Relocations for control-flow instructions.  */
    310       1.1  christos 
    311   1.1.1.2  christos /* TBZ/NZ: ((S+A-P) >> 2) & 0x3fff.  */
    312       1.1  christos RELOC_NUMBER (R_AARCH64_TSTBR14, 279)
    313       1.1  christos 
    314   1.1.1.2  christos /* B.cond: ((S+A-P) >> 2) & 0x7ffff.  */
    315       1.1  christos RELOC_NUMBER (R_AARCH64_CONDBR19, 280)
    316       1.1  christos 
    317       1.1  christos /* 281 unused */
    318       1.1  christos 
    319   1.1.1.2  christos /* B:      ((S+A-P) >> 2) & 0x3ffffff.  */
    320       1.1  christos RELOC_NUMBER (R_AARCH64_JUMP26, 282)
    321       1.1  christos 
    322   1.1.1.2  christos /* BL:     ((S+A-P) >> 2) & 0x3ffffff.  */
    323       1.1  christos RELOC_NUMBER (R_AARCH64_CALL26, 283)
    324       1.1  christos 
    325       1.1  christos /* LD/ST16: (S+A) & 0xffe */
    326       1.1  christos RELOC_NUMBER (R_AARCH64_LDST16_ABS_LO12_NC, 284)
    327       1.1  christos 
    328       1.1  christos /* LD/ST32: (S+A) & 0xffc */
    329       1.1  christos RELOC_NUMBER (R_AARCH64_LDST32_ABS_LO12_NC, 285)
    330       1.1  christos 
    331       1.1  christos /* LD/ST64: (S+A) & 0xff8 */
    332       1.1  christos RELOC_NUMBER (R_AARCH64_LDST64_ABS_LO12_NC, 286)
    333       1.1  christos 
    334   1.1.1.2  christos /* Group relocations to create a 16, 32, 48, or 64 bit PC-relative
    335   1.1.1.2  christos    offset inline.  */
    336   1.1.1.2  christos 
    337   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_MOVW_PREL_G0, 287)
    338   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_MOVW_PREL_G0_NC, 288)
    339   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_MOVW_PREL_G1, 289)
    340   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_MOVW_PREL_G1_NC, 290)
    341   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_MOVW_PREL_G2, 291)
    342   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_MOVW_PREL_G2_NC, 292)
    343   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_MOVW_PREL_G3, 293)
    344   1.1.1.2  christos 
    345       1.1  christos /* LD/ST128: (S+A) & 0xff0 */
    346       1.1  christos RELOC_NUMBER (R_AARCH64_LDST128_ABS_LO12_NC, 299)
    347       1.1  christos 
    348   1.1.1.2  christos /* Group relocations to create a 16, 32, 48, or 64 bit GOT-relative
    349   1.1.1.2  christos    offset inline.  */
    350   1.1.1.2  christos 
    351   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_MOVW_GOTOFF_G0, 300)
    352   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_MOVW_GOTOFF_G0_NC, 301)
    353   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_MOVW_GOTOFF_G1, 302)
    354   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_MOVW_GOTOFF_G1_NC, 303)
    355   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_MOVW_GOTOFF_G2, 304)
    356   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_MOVW_GOTOFF_G2_NC, 305)
    357   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_MOVW_GOTOFF_G3, 306)
    358   1.1.1.2  christos 
    359   1.1.1.2  christos /* GOT-relative data relocations.  */
    360   1.1.1.2  christos 
    361   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_GOTREL64, 307)
    362   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_GOTREL32, 308)
    363   1.1.1.2  christos 
    364   1.1.1.2  christos /* GOT-relative instruction relocations.  */
    365   1.1.1.2  christos 
    366   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_GOT_LD_PREL19, 309)
    367   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_LD64_GOTOFF_LO15, 310)
    368       1.1  christos RELOC_NUMBER (R_AARCH64_ADR_GOT_PAGE, 311)
    369       1.1  christos RELOC_NUMBER (R_AARCH64_LD64_GOT_LO12_NC, 312)
    370   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_LD64_GOTPAGE_LO15, 313)
    371       1.1  christos 
    372   1.1.1.2  christos /* General Dynamic TLS relocations.  */
    373       1.1  christos 
    374   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSGD_ADR_PREL21, 512)
    375       1.1  christos RELOC_NUMBER (R_AARCH64_TLSGD_ADR_PAGE21, 513)
    376       1.1  christos RELOC_NUMBER (R_AARCH64_TLSGD_ADD_LO12_NC, 514)
    377   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSGD_MOVW_G1, 515)
    378   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSGD_MOVW_G0_NC, 516)
    379   1.1.1.2  christos 
    380   1.1.1.2  christos /* Local Dynamic TLS relocations.  */
    381   1.1.1.2  christos 
    382   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSLD_ADR_PREL21, 517)
    383   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSLD_ADR_PAGE21, 518)
    384   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSLD_ADD_LO12_NC, 519)
    385   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSLD_MOVW_G1, 520)
    386   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSLD_MOVW_G0_NC, 521)
    387   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSLD_LD_PREL19, 522)
    388   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSLD_MOVW_DTPREL_G2, 523)
    389   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSLD_MOVW_DTPREL_G1, 524)
    390   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC, 525)
    391   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSLD_MOVW_DTPREL_G0, 526)
    392   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC, 527)
    393   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSLD_ADD_DTPREL_HI12, 528)
    394   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSLD_ADD_DTPREL_LO12, 529)
    395   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC, 530)
    396   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSLD_LDST8_DTPREL_LO12, 531)
    397   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC, 532)
    398   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSLD_LDST16_DTPREL_LO12, 533)
    399   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC, 534)
    400   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSLD_LDST32_DTPREL_LO12, 535)
    401   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC, 536)
    402   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSLD_LDST64_DTPREL_LO12, 537)
    403   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC, 538)
    404   1.1.1.2  christos 
    405   1.1.1.2  christos /* Initial Exec TLS relocations.  */
    406   1.1.1.2  christos 
    407       1.1  christos RELOC_NUMBER (R_AARCH64_TLSIE_MOVW_GOTTPREL_G1, 539)
    408       1.1  christos RELOC_NUMBER (R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC, 540)
    409       1.1  christos RELOC_NUMBER (R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21, 541)
    410       1.1  christos RELOC_NUMBER (R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC, 542)
    411       1.1  christos RELOC_NUMBER (R_AARCH64_TLSIE_LD_GOTTPREL_PREL19, 543)
    412   1.1.1.2  christos 
    413   1.1.1.2  christos /* Local Exec TLS relocations.  */
    414   1.1.1.2  christos 
    415       1.1  christos RELOC_NUMBER (R_AARCH64_TLSLE_MOVW_TPREL_G2, 544)
    416       1.1  christos RELOC_NUMBER (R_AARCH64_TLSLE_MOVW_TPREL_G1, 545)
    417       1.1  christos RELOC_NUMBER (R_AARCH64_TLSLE_MOVW_TPREL_G1_NC, 546)
    418       1.1  christos RELOC_NUMBER (R_AARCH64_TLSLE_MOVW_TPREL_G0, 547)
    419       1.1  christos RELOC_NUMBER (R_AARCH64_TLSLE_MOVW_TPREL_G0_NC, 548)
    420       1.1  christos RELOC_NUMBER (R_AARCH64_TLSLE_ADD_TPREL_HI12, 549)
    421       1.1  christos RELOC_NUMBER (R_AARCH64_TLSLE_ADD_TPREL_LO12, 550)
    422       1.1  christos RELOC_NUMBER (R_AARCH64_TLSLE_ADD_TPREL_LO12_NC, 551)
    423   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSLE_LDST8_TPREL_LO12, 552)
    424   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC, 553)
    425   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSLE_LDST16_TPREL_LO12, 554)
    426   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC, 555)
    427   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSLE_LDST32_TPREL_LO12, 556)
    428   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC, 557)
    429   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSLE_LDST64_TPREL_LO12, 558)
    430   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC, 559)
    431       1.1  christos 
    432   1.1.1.2  christos /* TLS descriptor relocations.  */
    433   1.1.1.2  christos 
    434   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSDESC_LD_PREL19, 560)
    435       1.1  christos RELOC_NUMBER (R_AARCH64_TLSDESC_ADR_PREL21, 561)
    436   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSDESC_ADR_PAGE21, 562)
    437   1.1.1.4  christos RELOC_NUMBER (R_AARCH64_TLSDESC_LD64_LO12, 563)
    438   1.1.1.4  christos RELOC_NUMBER (R_AARCH64_TLSDESC_ADD_LO12, 564)
    439       1.1  christos RELOC_NUMBER (R_AARCH64_TLSDESC_OFF_G1, 565)
    440       1.1  christos RELOC_NUMBER (R_AARCH64_TLSDESC_OFF_G0_NC, 566)
    441       1.1  christos RELOC_NUMBER (R_AARCH64_TLSDESC_LDR, 567)
    442       1.1  christos RELOC_NUMBER (R_AARCH64_TLSDESC_ADD, 568)
    443       1.1  christos RELOC_NUMBER (R_AARCH64_TLSDESC_CALL, 569)
    444   1.1.1.2  christos 
    445   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSLE_LDST128_TPREL_LO12, 570)
    446   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC, 571)
    447   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSLD_LDST128_DTPREL_LO12, 572)
    448   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC, 573)
    449       1.1  christos 
    450       1.1  christos /* Dynamic relocations */
    451       1.1  christos 
    452       1.1  christos /* Copy symbol at runtime.  */
    453       1.1  christos RELOC_NUMBER (R_AARCH64_COPY, 1024)
    454       1.1  christos 
    455       1.1  christos /* Create GOT entry.  */
    456       1.1  christos RELOC_NUMBER (R_AARCH64_GLOB_DAT, 1025)
    457       1.1  christos 
    458       1.1  christos  /* Create PLT entry.  */
    459       1.1  christos RELOC_NUMBER (R_AARCH64_JUMP_SLOT, 1026)
    460       1.1  christos 
    461       1.1  christos /* Adjust by program base.  */
    462       1.1  christos RELOC_NUMBER (R_AARCH64_RELATIVE, 1027)
    463       1.1  christos RELOC_NUMBER (R_AARCH64_TLS_DTPMOD64, 1028)
    464       1.1  christos RELOC_NUMBER (R_AARCH64_TLS_DTPREL64, 1029)
    465       1.1  christos RELOC_NUMBER (R_AARCH64_TLS_TPREL64, 1030)
    466   1.1.1.2  christos /* Aliasing relocs are guarded by RELOC_MACROS_GEN_FUNC
    467   1.1.1.2  christos    so that readelf.c won't generate duplicated case
    468   1.1.1.2  christos    statements.  */
    469   1.1.1.2  christos #ifndef RELOC_MACROS_GEN_FUNC
    470   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLS_DTPMOD, 1028)
    471   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLS_DTPREL, 1029)
    472   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_TLS_TPREL, 1030)
    473   1.1.1.2  christos #endif
    474       1.1  christos RELOC_NUMBER (R_AARCH64_TLSDESC, 1031)
    475   1.1.1.2  christos RELOC_NUMBER (R_AARCH64_IRELATIVE, 1032)
    476       1.1  christos 
    477       1.1  christos END_RELOC_NUMBERS (R_AARCH64_end)
    478       1.1  christos 
    479       1.1  christos #endif /* _ELF_AARCH64_H */
    480