1 /* $NetBSD: elf_machdep.h,v 1.14 2013/10/29 00:45:00 matt Exp $ */ 2 3 #ifndef _ARM_ELF_MACHDEP_H_ 4 #define _ARM_ELF_MACHDEP_H_ 5 6 #if defined(__ARMEB__) 7 #define ELF32_MACHDEP_ENDIANNESS ELFDATA2MSB 8 #else 9 #define ELF32_MACHDEP_ENDIANNESS ELFDATA2LSB 10 #endif 11 12 #define ELF64_MACHDEP_ENDIANNESS XXX /* break compilation */ 13 #define ELF64_MACHDEP_ID_CASES \ 14 /* no 64-bit ELF machine types supported */ 15 16 /* Processor specific flags for the ELF header e_flags field. */ 17 #define EF_ARM_RELEXEC 0x00000001 18 #define EF_ARM_HASENTRY 0x00000002 19 #define EF_ARM_INTERWORK 0x00000004 /* GNU binutils 000413 */ 20 #define EF_ARM_SYMSARESORTED 0x00000004 /* ARM ELF A08 */ 21 #define EF_ARM_APCS_26 0x00000008 /* GNU binutils 000413 */ 22 #define EF_ARM_DYNSYMSUSESEGIDX 0x00000008 /* ARM ELF B01 */ 23 #define EF_ARM_APCS_FLOAT 0x00000010 /* GNU binutils 000413 */ 24 #define EF_ARM_MAPSYMSFIRST 0x00000010 /* ARM ELF B01 */ 25 #define EF_ARM_PIC 0x00000020 26 #define EF_ARM_ALIGN8 0x00000040 /* 8-bit structure alignment. */ 27 #define EF_ARM_NEW_ABI 0x00000080 28 #define EF_ARM_OLD_ABI 0x00000100 29 #define EF_ARM_SOFT_FLOAT 0x00000200 30 #define EF_ARM_BE8 0x00800000 31 #define EF_ARM_EABIMASK 0xff000000 32 #define EF_ARM_EABI_VER1 0x01000000 33 #define EF_ARM_EABI_VER2 0x02000000 34 #define EF_ARM_EABI_VER3 0x03000000 35 #define EF_ARM_EABI_VER4 0x04000000 36 #define EF_ARM_EABI_VER5 0x05000000 37 38 #define ELF32_MACHDEP_ID_CASES \ 39 case EM_ARM: \ 40 break; 41 42 #define ELF32_MACHDEP_ID EM_ARM 43 44 #define ARCH_ELFSIZE 32 /* MD native binary size */ 45 46 /* Processor specific relocation types */ 47 48 #define R_ARM_NONE 0 49 #define R_ARM_PC24 1 50 #define R_ARM_ABS32 2 51 #define R_ARM_REL32 3 52 #define R_ARM_PC13 4 53 #define R_ARM_ABS16 5 54 #define R_ARM_ABS12 6 55 #define R_ARM_THM_ABS5 7 56 #define R_ARM_ABS8 8 57 #define R_ARM_SBREL32 9 58 #define R_ARM_THM_PC22 10 59 #define R_ARM_THM_PC8 11 60 #define R_ARM_AMP_VCALL9 12 61 #define R_ARM_SWI24 13 62 #define R_ARM_THM_SWI8 14 63 #define R_ARM_XPC25 15 64 #define R_ARM_THM_XPC22 16 65 66 /* TLS relocations */ 67 #define R_ARM_TLS_DTPMOD32 17 /* ID of module containing symbol */ 68 #define R_ARM_TLS_DTPOFF32 18 /* Offset in TLS block */ 69 #define R_ARM_TLS_TPOFF32 19 /* Offset in static TLS block */ 70 71 /* 20-31 are reserved for ARM Linux. */ 72 #define R_ARM_COPY 20 73 #define R_ARM_GLOB_DAT 21 74 #define R_ARM_JUMP_SLOT 22 75 #define R_ARM_RELATIVE 23 76 #define R_ARM_GOTOFF 24 77 #define R_ARM_GOTPC 25 78 #define R_ARM_GOT32 26 79 #define R_ARM_PLT32 27 80 #define R_ARM_CALL 28 81 #define R_ARM_JUMP24 29 82 #define R_ARM_THM_JUMP24 30 83 #define R_ARM_BASE_ABS 31 84 #define R_ARM_ALU_PCREL_7_0 32 85 #define R_ARM_ALU_PCREL_15_8 33 86 #define R_ARM_ALU_PCREL_23_15 34 87 #define R_ARM_ALU_SBREL_11_0 35 88 #define R_ARM_ALU_SBREL_19_12 36 89 #define R_ARM_ALU_SBREL_27_20 37 // depcreated 90 #define R_ARM_TARGET1 38 91 #define R_ARM_SBREL31 39 // deprecated 92 #define R_ARM_V4BX 40 93 #define R_ARM_TARGET2 41 94 #define R_ARM_PREL31 42 95 #define R_ARM_MOVW_ABS_NC 43 96 #define R_ARM_MOVT_ABS 44 97 #define R_ARM_MOVW_PREL_NC 45 98 #define R_ARM_MOVT_PREL 46 99 #define R_ARM_THM_MOVW_ABS_NC 47 100 #define R_ARM_THM_MOVT_ABS 48 101 #define R_ARM_THM_MOVW_PREL_NC 49 102 #define R_ARM_THM_MOVT_PREL 50 103 104 /* 96-111 are reserved to G++. */ 105 #define R_ARM_GNU_VTENTRY 100 106 #define R_ARM_GNU_VTINHERIT 101 107 #define R_ARM_THM_PC11 102 108 #define R_ARM_THM_PC9 103 109 110 /* More TLS relocations */ 111 #define R_ARM_TLS_GD32 104 /* PC-rel 32 bit for global dynamic */ 112 #define R_ARM_TLS_LDM32 105 /* PC-rel 32 bit for local dynamic */ 113 #define R_ARM_TLS_LDO32 106 /* 32 bit offset relative to TLS */ 114 #define R_ARM_TLS_IE32 107 /* PC-rel 32 bit for GOT entry of */ 115 #define R_ARM_TLS_LE32 108 116 #define R_ARM_TLS_LDO12 109 117 #define R_ARM_TLS_LE12 110 118 #define R_ARM_TLS_IE12GP 111 119 120 /* 112-127 are reserved for private experiments. */ 121 122 #define R_ARM_RXPC25 249 123 #define R_ARM_RSBREL32 250 124 #define R_ARM_THM_RPC22 251 125 #define R_ARM_RREL32 252 126 #define R_ARM_RABS32 253 127 #define R_ARM_RPC24 254 128 #define R_ARM_RBASE 255 129 130 #define R_AARCH64_ABS64 257 /* S + A */ 131 #define R_AARCH64_ABS32 258 /* S + A */ 132 #define R_AARCH64_ABS16 259 /* S + A */ 133 #define R_AARCH64_PREL64 260 /* S + A - P */ 134 #define R_AARCH64_PREL32 261 /* S + A - P */ 135 #define R_AARCH64_PREL16 262 /* S + A - P */ 136 #define R_AARCH64_MOVW_UABS_G0 263 /* S + A [bits 0..15] */ 137 #define R_AARCH64_MOVW_UABS_G0_NC 264 /* S + A [bits 0..15] */ 138 #define R_AARCH64_MOVW_UABS_G1 265 /* S + A [bits 16..31] */ 139 #define R_AARCH64_MOVW_UABS_G1_NC 266 /* S + A [bits 16..31] */ 140 #define R_AARCH64_MOVW_UABS_G2 267 /* S + A [bits 32..47] */ 141 #define R_AARCH64_MOVW_UABS_G2_NC 268 /* S + A [bits 32..47] */ 142 #define R_AARCH64_MOVW_UABS_G3 269 /* S + A [bits 48..63] */ 143 #define R_AARCH64_MOVW_SABS_G0 270 /* S + A [bits 0..15] */ 144 #define R_AARCH64_MOVW_SABS_G1 271 /* S + A [bits 16..31] */ 145 #define R_AARCH64_MOVW_SABS_G2 272 /* S + A [bits 32..47] */ 146 #define R_AARCH64_LD_PREL_LO19 273 /* S + A - P */ 147 #define R_AARCH64_ADR_PREL_LO21 274 /* S + A - P */ 148 #define R_AARCH64_ADR_PREL_PG_HI21 275 /* Page(S + A) - Page(P) */ 149 #define R_AARCH64_ADR_PREL_PG_HI21_NC 276 /* Page(S + A) - Page(P) */ 150 #define R_AARCH64_ADR_ABS_LO21_NC 277 /* S + A */ 151 #define R_AARCH64_LDST8_ABS_LO12_NC 278 /* S + A */ 152 #define R_AARCH_TSTBR14 279 /* S + A - P */ 153 #define R_AARCH_CONDBR19 281 /* S + A - P */ 154 #define R_AARCH_JUMP26 282 /* S + A - P */ 155 #define R_AARCH_CALL26 283 /* S + A - P */ 156 #define R_AARCH_LDST16_ABS_LO12_NC 284 /* S + A */ 157 #define R_AARCH_LDST32_ABS_LO12_NC 285 /* S + A */ 158 #define R_AARCH_LDST64_ABS_LO12_NC 286 /* S + A */ 159 #define R_AARCH64_MOVW_PREL_G0 287 /* S + A - P */ 160 #define R_AARCH64_MOVW_PREL_G0_NC 288 /* S + A - P */ 161 #define R_AARCH64_MOVW_PREL_G1 289 /* S + A - P */ 162 #define R_AARCH64_MOVW_PREL_G1_NC 290 /* S + A - P */ 163 #define R_AARCH64_MOVW_PREL_G2 291 /* S + A - P */ 164 #define R_AARCH64_MOVW_PREL_G2_NC 292 /* S + A - P */ 165 #define R_AARCH64_MOVW_PREL_G3 293 /* S + A - P */ 166 167 #define R_AARCH64_LDST128_ABS_LO12_NC 299 /* S + A */ 168 #define R_AARCH64_MOVW_GOTOFF_G0 300 /* G(GDAT(S + A)) - GOT */ 169 #define R_AARCH64_MOVW_GOTOFF_G0_NC 301 /* G(GDAT(S + A)) - GOT */ 170 #define R_AARCH64_MOVW_GOTOFF_G1 302 /* G(GDAT(S + A)) - GOT */ 171 #define R_AARCH64_MOVW_GOTOFF_G1_NC 303 /* G(GDAT(S + A)) - GOT */ 172 #define R_AARCH64_MOVW_GOTOFF_G2 304 /* G(GDAT(S + A)) - GOT */ 173 #define R_AARCH64_MOVW_GOTOFF_G2_NC 305 /* G(GDAT(S + A)) - GOT */ 174 #define R_AARCH64_MOVW_GOTOFF_G3 306 /* G(GDAT(S + A)) - GOT */ 175 #define R_AARCH64_GOTREL64 307 /* S + A - GOT */ 176 #define R_AARCH64_GOTREL32 308 /* S + A - GOT */ 177 #define R_AARCH64_GOT_LD_PREL19 309 /* G(GDAT(S + A)) - P */ 178 #define R_AARCH64_LD64_GOTOFF_LO15 310 /* G(GDAT(S + A)) - GOT */ 179 #define R_AARCH64_ADR_GOT_PAGE 311 /* Page(G(GDAT(S + A))) - Page(GOT) */ 180 #define R_AARCH64_LD64_GOT_LO12_NC 312 /* G(GDAT(S + A)) */ 181 #define R_AARCH64_LD64_GOTPAGE_LO15 313 /* G(GDAT(S + A)) - Page(GOT) */ 182 183 #define R_AARCH64_TLSGD_ADR_PREL21 512 /* G(GTLSIDX(S,A)) - P */ 184 #define R_AARCH64_TLSGD_ADR_PAGE21 513 /* Page(G(GTLSIDX(S,A))) - Page(P) */ 185 #define R_AARCH64_TLSGD_ADD_LO12_NC 514 /* G(GTLSIDX(S,A)) */ 186 #define R_AARCH64_TLSGD_MOVW_G1 515 /* G(GTLSIDX(S,A)) - GOT */ 187 #define R_AARCH64_TLSGD_MOVW_G0_NV 516 /* G(GTLSIDX(S,A)) - GOT */ 188 #define R_AARCH64_TLSLD_ADR_PREL21 517 /* G(GLDM(S,A)) - P */ 189 #define R_AARCH64_TLSLD_ADR_PAGE21 518 /* Page(G(GLDM(S))) - Page(P) */ 190 #define R_AARCH64_TLSLD_ADD_LO12_NC 519 /* G(GLDM(S)) */ 191 #define R_AARCH64_TLSLD_MOVW_G1 520 /* G(GLDM(S)) - GOT */ 192 #define R_AARCH64_TLSLD_MOVW_G0_NC 521 /* G(GLDM(S)) - GOT */ 193 #define R_AARCH64_TLSLD_LD_PREL21 522 /* G(GLDM(S)) - P */ 194 #define R_AARCH64_TLSLD_MOVW_DTPREL_G2 523 /* DTPREL(S+A) */ 195 #define R_AARCH64_TLSLD_MOVW_DTPREL_G1 524 /* DTPREL(S+A) */ 196 #define R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC 525 /* DTPREL(S+A) */ 197 #define R_AARCH64_TLSLD_MOVW_DTPREL_G0 526 /* DTPREL(S+A) */ 198 #define R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC 528 /* DTPREL(S+A) */ 199 #define R_AARCH64_TLSLD_ADD_DTPREL_HI12 528 /* DTPREL(S+A) */ 200 #define R_AARCH64_TLSLD_ADD_DTPREL_HI12 528 /* DTPREL(S+A) */ 201 #define R_AARCH64_TLSLD_ADD_DTPREL_LO12 529 /* DTPREL(S+A) */ 202 #define R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC 530 /* DTPREL(S+A) */ 203 #define R_AARCH64_TLSLD_LDST8_DTPREL_LO12 531 /* DTPREL(S+A) */ 204 #define R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC 532 /* DTPREL(S+A) */ 205 #define R_AARCH64_TLSLD_LDST16_DTPREL_LO12 533 /* DTPREL(S+A) */ 206 #define R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC 534 /* DTPREL(S+A) */ 207 #define R_AARCH64_TLSLD_LDST32_DTPREL_LO12 535 /* DTPREL(S+A) */ 208 #define R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC 536 /* DTPREL(S+A) */ 209 #define R_AARCH64_TLSLD_LDST64_DTPREL_LO12 537 /* DTPREL(S+A) */ 210 #define R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC 538 /* DTPREL(S+A) */ 211 #define R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 539 /* G(GTPREL(S+A)) - GOT */ 212 #define R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC 540 /* G(GTPREL(S+A)) - GOT */ 213 #define R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 541 /* Page(G(GTPREL(S+A))) - Page(P) */ 214 #define R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC 542 /* G(GTPREL(S+A)) */ 215 #define R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 543 /* G(GTPREL(S+A)) - P */ 216 #define R_AARCH64_TLSLE_MOVW_TPREL_G2 544 /* TPREL(S+A) */ 217 #define R_AARCH64_MOVW_TPREL_G1 545 /* TPREL(S+A) */ 218 #define R_AARCH64_MOVW_TPREL_G1_NC 546 /* TPREL(S+A) */ 219 #define R_AARCH64_MOVW_TPREL_G0 547 /* TPREL(S+A) */ 220 #define R_AARCH64_MOVW_TPREL_G0_NC 548 /* TPREL(S+A) */ 221 #define R_AARCH64_ADD_TPREL_HI12 549 /* TPREL(S+A) */ 222 #define R_AARCH64_ADD_TPREL_LO12 550 /* TPREL(S+A) */ 223 #define R_AARCH64_ADD_TPREL_LO12_NC 551 /* TPREL(S+A) */ 224 #define R_AARCH64_LDST8_TPREL_LO12 552 /* TPREL(S+A) */ 225 #define R_AARCH64_LDST8_TPREL_LO12_NC 553 /* TPREL(S+A) */ 226 #define R_AARCH64_LDST16_TPREL_LO12 554 /* TPREL(S+A) */ 227 #define R_AARCH64_LDST16_TPREL_LO12_NC 555 /* TPREL(S+A) */ 228 #define R_AARCH64_LDST32_TPREL_LO12 556 /* TPREL(S+A) */ 229 #define R_AARCH64_LDST32_TPREL_LO12_NC 557 /* TPREL(S+A) */ 230 #define R_AARCH64_LDST64_TPREL_LO12 558 /* TPREL(S+A) */ 231 #define R_AARCH64_LDST64_TPREL_LO12_NC 559 /* TPREL(S+A) */ 232 #define R_AARCH64_TLSDESC_LD_PREL19 560 /* G(GTLSDESC(S+A)) - P */ 233 #define R_AARCH64_TLSDESC_LD_PREL21 561 /* G(GTLSDESC(S+A)) - P */ 234 #define R_AARCH64_TLSDESC_LD_PAGE21 562 /* Page(G(GTLSDESC(S+A))) - Page(P) */ 235 #define R_AARCH64_TLSDESC_LD64_LO12 563 /* G(GTLSDESC(S+A)) */ 236 #define R_AARCH64_TLSDESC_ADD_LO12 564 /* G(GTLSDESC(S+A)) */ 237 #define R_AARCH64_TLSDESC_OFF_G1 565 /* G(GTLSDESC(S+A)) - GOT */ 238 #define R_AARCH64_TLSDESC_OFF_G0_NC 566 /* G(GTLSDESC(S+A)) - GOT */ 239 #define R_AARCH64_TLSDESC_LDR 567 /* */ 240 #define R_AARCH64_TLSDESC_ADD 568 /* */ 241 #define R_AARCH64_TLSDESC_CALL 569 /* */ 242 #define R_AARCH64_TLSLE_LDST128_TPREL_LO12 570 /* TPREL(S+A) */ 243 #define R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC 571 /* TPREL(S+A) */ 244 #define R_AARCH64_TLSLD_LDST128_DTPREL_LO12 572 /* DTPREL(S+A) */ 245 #define R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC 572 /* DTPREL(S+A) */ 246 247 #define R_AARCH64_COPY 1024 248 #define R_AARCH64_GLOB_DAT 1025 /* S + A */ 249 #define R_AARCH64_JUMP_SLOT 1026 /* S + A */ 250 #define R_AARCH64_RELATIVE 1027 /* Delta(S) + A */ 251 #define R_AARCH64_TLS_DTPREL64 1028 /* DTPREL(S+A) */ 252 #define R_AARCH64_TLS_DTPMOD64 1029 /* LBM(S) */ 253 #define R_AARCH64_TLS_TPREL64 1030 /* TPREL(S+A) */ 254 #define R_AARCH64_TLSDESC 1031 /* TLSDESC(S+A) */ 255 #define R_AARCH64_IRELATIVE 1032 /* Indirect(Delta(S) + A) */ 256 257 #define R_TYPE(name) __CONCAT(R_ARM_,name) 258 259 /* Processor specific program header flags */ 260 #define PF_ARM_SB 0x10000000 261 #define PF_ARM_PI 0x20000000 262 #define PF_ARM_ENTRY 0x80000000 263 264 /* Processor specific program header types */ 265 #define PT_ARM_EXIDX (PT_LOPROC + 1) 266 #define PT_AARCH64_ARCHEXT (PT_LOPROC + 0) 267 #define PT_AARCH64_UNWIND (PT_LOPROC + 1) 268 269 /* Processor specific section header flags */ 270 #define SHF_ENTRYSECT 0x10000000 271 #define SHF_COMDEF 0x80000000 272 273 #define SHT_AARCH64_ATTRIBUTES (SHT_LOPROC + 3) 274 275 /* Processor specific symbol types */ 276 #define STT_ARM_TFUNC STT_LOPROC 277 278 #ifdef _KERNEL 279 #ifdef ELFSIZE 280 #define ELF_MD_PROBE_FUNC ELFNAME2(arm_netbsd,probe) 281 #endif 282 283 struct exec_package; 284 285 int arm_netbsd_elf32_probe(struct lwp *, struct exec_package *, void *, char *, 286 vaddr_t *); 287 #endif 288 289 #endif /* _ARM_ELF_MACHDEP_H_ */ 290