Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:23

0001 /*  $NetBSD: elf_machdep.h,v 1.19 2017/11/06 03:47:45 christos Exp $    */
0002 
0003 #ifndef _ARM_ELF_MACHDEP_H_
0004 #define _ARM_ELF_MACHDEP_H_
0005 
0006 #if defined(__ARMEB__)
0007 #define ELF32_MACHDEP_ENDIANNESS    ELFDATA2MSB
0008 #else
0009 #define ELF32_MACHDEP_ENDIANNESS    ELFDATA2LSB
0010 #endif
0011 
0012 #define ELF64_MACHDEP_ENDIANNESS    XXX /* break compilation */
0013 #define ELF64_MACHDEP_ID_CASES                                          \
0014         /* no 64-bit ELF machine types supported */
0015 
0016 /* Processor specific flags for the ELF header e_flags field.  */
0017 #define EF_ARM_RELEXEC      0x00000001
0018 #define EF_ARM_HASENTRY     0x00000002
0019 #define EF_ARM_INTERWORK    0x00000004 /* GNU binutils 000413 */
0020 #define EF_ARM_SYMSARESORTED    0x00000004 /* ARM ELF A08 */
0021 #define EF_ARM_APCS_26      0x00000008 /* GNU binutils 000413 */
0022 #define EF_ARM_DYNSYMSUSESEGIDX 0x00000008 /* ARM ELF B01 */
0023 #define EF_ARM_APCS_FLOAT   0x00000010 /* GNU binutils 000413 */
0024 #define EF_ARM_MAPSYMSFIRST 0x00000010 /* ARM ELF B01 */
0025 #define EF_ARM_PIC      0x00000020
0026 #define EF_ARM_ALIGN8       0x00000040 /* 8-bit structure alignment.  */
0027 #define EF_ARM_NEW_ABI      0x00000080
0028 #define EF_ARM_OLD_ABI      0x00000100
0029 #define EF_ARM_SOFT_FLOAT   0x00000200
0030 #define EF_ARM_BE8      0x00800000
0031 #define EF_ARM_EABIMASK     0xff000000
0032 #define EF_ARM_EABI_VER1    0x01000000
0033 #define EF_ARM_EABI_VER2    0x02000000
0034 #define EF_ARM_EABI_VER3    0x03000000
0035 #define EF_ARM_EABI_VER4    0x04000000
0036 #define EF_ARM_EABI_VER5    0x05000000
0037 
0038 #define ELF32_MACHDEP_ID_CASES                      \
0039         case EM_ARM:                        \
0040             break;
0041 
0042 #define ELF32_MACHDEP_ID    EM_ARM
0043 
0044 #define KERN_ELFSIZE        32
0045 #define ARCH_ELFSIZE        32  /* MD native binary size */
0046 
0047 /* Processor specific relocation types */
0048 
0049 #define R_ARM_NONE      0
0050 #define R_ARM_PC24      1
0051 #define R_ARM_ABS32     2
0052 #define R_ARM_REL32     3
0053 #define R_ARM_PC13      4
0054 #define R_ARM_ABS16     5
0055 #define R_ARM_ABS12     6
0056 #define R_ARM_THM_ABS5      7
0057 #define R_ARM_ABS8      8
0058 #define R_ARM_SBREL32       9
0059 #define R_ARM_THM_PC22      10
0060 #define R_ARM_THM_PC8       11
0061 #define R_ARM_AMP_VCALL9    12
0062 #define R_ARM_SWI24     13
0063 #define R_ARM_THM_SWI8      14
0064 #define R_ARM_XPC25     15
0065 #define R_ARM_THM_XPC22     16
0066 
0067 /* TLS relocations */
0068 #define R_ARM_TLS_DTPMOD32  17  /* ID of module containing symbol */
0069 #define R_ARM_TLS_DTPOFF32  18  /* Offset in TLS block */
0070 #define R_ARM_TLS_TPOFF32   19  /* Offset in static TLS block */
0071 
0072 /* 20-31 are reserved for ARM Linux. */
0073 #define R_ARM_COPY      20
0074 #define R_ARM_GLOB_DAT      21
0075 #define R_ARM_JUMP_SLOT     22
0076 #define R_ARM_RELATIVE      23
0077 #define R_ARM_GOTOFF        24
0078 #define R_ARM_GOTPC     25
0079 #define R_ARM_GOT32     26
0080 #define R_ARM_PLT32     27
0081 #define R_ARM_CALL      28
0082 #define R_ARM_JUMP24        29
0083 #define R_ARM_THM_JUMP24    30
0084 #define R_ARM_BASE_ABS      31
0085 #define R_ARM_ALU_PCREL_7_0 32
0086 #define R_ARM_ALU_PCREL_15_8    33
0087 #define R_ARM_ALU_PCREL_23_15   34
0088 #define R_ARM_ALU_SBREL_11_0    35
0089 #define R_ARM_ALU_SBREL_19_12   36
0090 #define R_ARM_ALU_SBREL_27_20   37  // depcreated
0091 #define R_ARM_TARGET1       38
0092 #define R_ARM_SBREL31       39  // deprecated
0093 #define R_ARM_V4BX      40
0094 #define R_ARM_TARGET2       41
0095 #define R_ARM_PREL31        42
0096 #define R_ARM_MOVW_ABS_NC   43
0097 #define R_ARM_MOVT_ABS      44
0098 #define R_ARM_MOVW_PREL_NC  45
0099 #define R_ARM_MOVT_PREL     46
0100 #define R_ARM_THM_MOVW_ABS_NC   47
0101 #define R_ARM_THM_MOVT_ABS  48
0102 #define R_ARM_THM_MOVW_PREL_NC  49
0103 #define R_ARM_THM_MOVT_PREL 50
0104 #define R_ARM_THM_JUMP19    51
0105 
0106 /* 96-111 are reserved to G++. */
0107 #define R_ARM_GNU_VTENTRY   100
0108 #define R_ARM_GNU_VTINHERIT 101
0109 #define R_ARM_THM_PC11      102
0110 #define R_ARM_THM_PC9       103
0111 
0112 /* More TLS relocations */
0113 #define R_ARM_TLS_GD32      104 /* PC-rel 32 bit for global dynamic */
0114 #define R_ARM_TLS_LDM32     105 /* PC-rel 32 bit for local dynamic */
0115 #define R_ARM_TLS_LDO32     106 /* 32 bit offset relative to TLS */
0116 #define R_ARM_TLS_IE32      107 /* PC-rel 32 bit for GOT entry of */
0117 #define R_ARM_TLS_LE32      108
0118 #define R_ARM_TLS_LDO12     109
0119 #define R_ARM_TLS_LE12      110
0120 #define R_ARM_TLS_IE12GP    111
0121 
0122 /* 112-127 are reserved for private experiments. */
0123 
0124 #define R_ARM_IRELATIVE     160
0125 
0126 #define R_ARM_RXPC25        249
0127 #define R_ARM_RSBREL32      250
0128 #define R_ARM_THM_RPC22     251
0129 #define R_ARM_RREL32        252
0130 #define R_ARM_RABS32        253
0131 #define R_ARM_RPC24     254
0132 #define R_ARM_RBASE     255
0133 
0134 #define R_TYPE(name)        __CONCAT(R_ARM_,name)
0135 
0136 /* Processor specific program header flags */
0137 #define PF_ARM_SB       0x10000000
0138 #define PF_ARM_PI       0x20000000
0139 #define PF_ARM_ENTRY        0x80000000
0140 
0141 /* Processor specific program header types */
0142 #define PT_ARM_EXIDX        (PT_LOPROC + 1)
0143 
0144 /* Processor specific section header flags */
0145 #define SHF_ENTRYSECT       0x10000000
0146 #define SHF_COMDEF      0x80000000
0147 
0148 /* Processor specific symbol types */
0149 #define STT_ARM_TFUNC       STT_LOPROC
0150 
0151 #ifdef _KERNEL
0152 #ifdef ELFSIZE
0153 #define ELF_MD_PROBE_FUNC   ELFNAME2(arm_netbsd,probe)
0154 #define ELF_MD_COREDUMP_SETUP   ELFNAME2(arm_netbsd,coredump_setup)
0155 #endif
0156 
0157 struct exec_package;
0158 
0159 int arm_netbsd_elf32_probe(struct lwp *, struct exec_package *, void *, char *,
0160     vaddr_t *);
0161 void arm_netbsd_elf32_coredump_setup(struct lwp *, void *);
0162 #endif
0163 
0164 #endif /* _ARM_ELF_MACHDEP_H_ */