1a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes/* $NetBSD: elf_machdep.h,v 1.10 2012/08/05 04:12:46 matt Exp $ */ 2a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes 3a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#ifndef _ARM_ELF_MACHDEP_H_ 4a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define _ARM_ELF_MACHDEP_H_ 5a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes 6a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#if defined(__ARMEB__) 7a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define ELF32_MACHDEP_ENDIANNESS ELFDATA2MSB 8a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#else 9a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define ELF32_MACHDEP_ENDIANNESS ELFDATA2LSB 10a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#endif 11a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes 12a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define ELF64_MACHDEP_ENDIANNESS XXX /* break compilation */ 13a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define ELF64_MACHDEP_ID_CASES \ 14a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes /* no 64-bit ELF machine types supported */ 15a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes 16a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes/* Processor specific flags for the ELF header e_flags field. */ 17a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define EF_ARM_RELEXEC 0x00000001 18a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define EF_ARM_HASENTRY 0x00000002 19a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define EF_ARM_INTERWORK 0x00000004 /* GNU binutils 000413 */ 20a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define EF_ARM_SYMSARESORTED 0x00000004 /* ARM ELF A08 */ 21a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define EF_ARM_APCS_26 0x00000008 /* GNU binutils 000413 */ 22a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define EF_ARM_DYNSYMSUSESEGIDX 0x00000008 /* ARM ELF B01 */ 23a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define EF_ARM_APCS_FLOAT 0x00000010 /* GNU binutils 000413 */ 24a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define EF_ARM_MAPSYMSFIRST 0x00000010 /* ARM ELF B01 */ 25a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define EF_ARM_PIC 0x00000020 26a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define EF_ARM_ALIGN8 0x00000040 /* 8-bit structure alignment. */ 27a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define EF_ARM_NEW_ABI 0x00000080 28a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define EF_ARM_OLD_ABI 0x00000100 29a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define EF_ARM_SOFT_FLOAT 0x00000200 30a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define EF_ARM_EABIMASK 0xff000000 31a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define EF_ARM_EABI_VER1 0x01000000 32a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define EF_ARM_EABI_VER2 0x02000000 33a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define EF_ARM_EABI_VER3 0x03000000 34a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define EF_ARM_EABI_VER4 0x04000000 35a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define EF_ARM_EABI_VER5 0x05000000 36a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes 37a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define ELF32_MACHDEP_ID_CASES \ 38a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes case EM_ARM: \ 39a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes break; 40a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes 41a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define ELF32_MACHDEP_ID EM_ARM 42a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes 43a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define ARCH_ELFSIZE 32 /* MD native binary size */ 44a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes 45a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes/* Processor specific relocation types */ 46a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes 47a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_NONE 0 48a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_PC24 1 49a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_ABS32 2 50a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_REL32 3 51a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_PC13 4 52a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_ABS16 5 53a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_ABS12 6 54a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_THM_ABS5 7 55a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_ABS8 8 56a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_SBREL32 9 57a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_THM_PC22 10 58a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_THM_PC8 11 59a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_AMP_VCALL9 12 60a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_SWI24 13 61a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_THM_SWI8 14 62a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_XPC25 15 63a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_THM_XPC22 16 64a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes 65a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes/* TLS relocations */ 66a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_TLS_DTPMOD32 17 /* ID of module containing symbol */ 67a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_TLS_DTPOFF32 18 /* Offset in TLS block */ 68a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_TLS_TPOFF32 19 /* Offset in static TLS block */ 69a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes 70a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes/* 20-31 are reserved for ARM Linux. */ 71a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_COPY 20 72a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_GLOB_DAT 21 73a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_JUMP_SLOT 22 74a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_RELATIVE 23 75a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_GOTOFF 24 76a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_GOTPC 25 77a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_GOT32 26 78a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_PLT32 27 79a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes 80a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_ALU_PCREL_7_0 32 81a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_ALU_PCREL_15_8 33 82a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_ALU_PCREL_23_15 34 83a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_ALU_SBREL_11_0 35 84a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_ALU_SBREL_19_12 36 85a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_ALU_SBREL_27_20 37 86a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes 87a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes/* 96-111 are reserved to G++. */ 88a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_GNU_VTENTRY 100 89a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_GNU_VTINHERIT 101 90a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_THM_PC11 102 91a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_THM_PC9 103 92a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes 93a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes/* More TLS relocations */ 94a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_TLS_GD32 104 /* PC-rel 32 bit for global dynamic */ 95a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_TLS_LDM32 105 /* PC-rel 32 bit for local dynamic */ 96a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_TLS_LDO32 106 /* 32 bit offset relative to TLS */ 97a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_TLS_IE32 107 /* PC-rel 32 bit for GOT entry of */ 98a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_TLS_LE32 108 99a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_TLS_LDO12 109 100a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_TLS_LE12 110 101a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_TLS_IE12GP 111 102a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes 103a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes/* 112-127 are reserved for private experiments. */ 104a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes 105a137f539801a05d395cfef1dd7a61b6fd8c36330Dmitriy Ivanov#define R_ARM_IRELATIVE 160 106a137f539801a05d395cfef1dd7a61b6fd8c36330Dmitriy Ivanov 107a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_RXPC25 249 108a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_RSBREL32 250 109a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_THM_RPC22 251 110a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_RREL32 252 111a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_RABS32 253 112a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_RPC24 254 113a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_ARM_RBASE 255 114a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes 115a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define R_TYPE(name) __CONCAT(R_ARM_,name) 116a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes 117a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes/* Processor specific program header flags */ 118a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define PF_ARM_SB 0x10000000 119a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define PF_ARM_PI 0x20000000 120a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define PF_ARM_ENTRY 0x80000000 121a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes 122a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes/* Processor specific section header flags */ 123a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define SHF_ENTRYSECT 0x10000000 124a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define SHF_COMDEF 0x80000000 125a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes 126a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes/* Processor specific symbol types */ 127a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define STT_ARM_TFUNC STT_LOPROC 128a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes 129a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#ifdef _KERNEL 130a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#ifdef ELFSIZE 131a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#define ELF_MD_PROBE_FUNC ELFNAME2(arm_netbsd,probe) 132a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#endif 133a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes 134a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughesstruct exec_package; 135a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes 136a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughesint arm_netbsd_elf32_probe(struct lwp *, struct exec_package *, void *, char *, 137a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes vaddr_t *); 138a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#endif 139a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes 140a6a3ac59243d8c95c94c3069e9332051f785c05fElliott Hughes#endif /* _ARM_ELF_MACHDEP_H_ */ 141