update include/elf.h following glibc changes
authorSzabolcs Nagy <nsz@port70.net>
Sun, 15 Sep 2013 14:53:34 +0000 (14:53 +0000)
committerSzabolcs Nagy <nsz@port70.net>
Mon, 16 Sep 2013 15:16:55 +0000 (15:16 +0000)
the changes were verified using various sources:
linux: include/uapi/linux/elf.h
binutils: include/elf/common.h
glibc: elf/elf.h
sysv gabi: http://www.sco.com/developers/gabi/latest/contents.html
sun linker docs: http://docs.oracle.com/cd/E18752_01/pdf/817-1984.pdf
and platform specific docs

- fixed:
EF_MIPS_* E_MIPS_* e_flags: fixed accoding to glibc and binutils

- added:
ELFOSABI_GNU for EI_OSABI entry: glibc, binutils and sysv gabi
EM_* e_machine values: updated according to linux and glibc
PN_XNUM e_phnum value: from glibc and linux, see oracle docs
NT_* note types: updated according to linux and glibc
DF_1_* flags for DT_FLAGS_1 entry: following glibc and oracle docs
AT_HWCAP2 auxv entry for more hwcap bits accoding to linux and glibc
R_386_SIZE32 relocation according to glibc and binutils
EF_ARM_ABI_FLOAT_* e_flags: added following glibc and binutils
R_AARCH64_* relocs: added following glibc and aarch64 elf specs
R_ARM_* relocs: according to glibc, binutils and arm elf specs
R_X86_64_* relocs: added missing relocs following glibc

- removed:
HWCAP_SPARC_* flags were moved to arch specific header in glibc
R_ARM_SWI24 reloc is marked as obsolete in glibc, not present in binutils
  not specified in arm elf spec, R_ARM_TLS_DESC reused its number
  see http://www.codesourcery.com/publications/RFC-TLSDESC-ARM.txt

- glibc changes not pulled in:
ELFOSABI_ARM_AEABI (bare-metal system, binutils and glibc disagrees about the name)
R_68K_* relocs for unsupported platform
R_SPARC_* ditto
EF_SH* ditto (e_flags)
EF_S390* ditto (e_flags)
R_390* ditto
R_MN10300* ditto
R_TILE* ditto

include/elf.h

index 0075f9f..690e44a 100644 (file)
@@ -105,6 +105,7 @@ typedef struct {
 #define ELFOSABI_HPUX          1
 #define ELFOSABI_NETBSD                2
 #define ELFOSABI_LINUX         3
+#define ELFOSABI_GNU           3
 #define ELFOSABI_SOLARIS       6
 #define ELFOSABI_AIX           7
 #define ELFOSABI_IRIX          8
@@ -211,7 +212,11 @@ typedef struct {
 #define EM_OPENRISC    92
 #define EM_ARC_A5      93
 #define EM_XTENSA      94
-#define EM_NUM         95
+#define EM_AARCH64     183
+#define EM_TILEPRO     188
+#define EM_MICROBLAZE  189
+#define EM_TILEGX      191
+#define EM_NUM         192
 #define EM_ALPHA       0x9026
 
 #define EV_NONE                0
@@ -487,6 +492,8 @@ typedef struct {
 #define PT_HIPROC      0x7fffffff
 
 
+#define PN_XNUM 0xffff
+
 
 #define PF_X           (1 << 0)
 #define PF_W           (1 << 1)
@@ -512,12 +519,31 @@ typedef struct {
 #define NT_LWPSTATUS   16
 #define NT_LWPSINFO    17
 #define NT_PRFPXREG    20
+#define NT_SIGINFO     0x53494749
+#define NT_FILE                0x46494c45
 #define NT_PRXFPREG    0x46e62b7f
 #define NT_PPC_VMX     0x100
 #define NT_PPC_SPE     0x101
 #define NT_PPC_VSX     0x102
 #define NT_386_TLS     0x200
 #define NT_386_IOPERM  0x201
+#define NT_X86_XSTATE  0x202
+#define NT_S390_HIGH_GPRS      0x300
+#define NT_S390_TIMER  0x301
+#define NT_S390_TODCMP 0x302
+#define NT_S390_TODPREG        0x303
+#define NT_S390_CTRS   0x304
+#define NT_S390_PREFIX 0x305
+#define NT_S390_LAST_BREAK     0x306
+#define NT_S390_SYSTEM_CALL    0x307
+#define NT_S390_TDB    0x308
+#define NT_ARM_VFP     0x400
+#define NT_ARM_TLS     0x401
+#define NT_ARM_HW_BREAK        0x402
+#define NT_ARM_HW_WATCH        0x403
+#define NT_METAG_CBUF  0x500
+#define NT_METAG_RPIPE 0x501
+#define NT_METAG_TLS   0x502
 #define NT_VERSION     1
 
 
@@ -666,7 +692,15 @@ typedef struct {
 #define DF_1_ENDFILTEE 0x00004000
 #define        DF_1_DISPRELDNE 0x00008000
 #define        DF_1_DISPRELPND 0x00010000
-
+#define        DF_1_NODIRECT   0x00020000
+#define        DF_1_IGNMULDEF  0x00040000
+#define        DF_1_NOKSYMS    0x00080000
+#define        DF_1_NOHDR      0x00100000
+#define        DF_1_EDITED     0x00200000
+#define        DF_1_NORELOC    0x00400000
+#define        DF_1_SYMINTPOSE 0x00800000
+#define        DF_1_GLOBAUDIT  0x01000000
+#define        DF_1_SINGLETON  0x02000000
 
 #define DTF_1_PARINIT  0x00000001
 #define DTF_1_CONFEXP  0x00000002
@@ -832,6 +866,8 @@ typedef struct {
 
 #define AT_RANDOM      25
 
+#define AT_HWCAP2      26
+
 #define AT_EXECFN      31
 
 
@@ -979,6 +1015,7 @@ typedef struct {
 #define R_386_TLS_DTPMOD32 35
 #define R_386_TLS_DTPOFF32 36
 #define R_386_TLS_TPOFF32  37
+#define R_386_SIZE32       38
 #define R_386_TLS_GOTDESC  39
 #define R_386_TLS_DESC_CALL 40
 #define R_386_TLS_DESC     41
@@ -1109,20 +1146,6 @@ typedef struct {
 #define DT_SPARC_NUM   2
 
 
-
-#define HWCAP_SPARC_FLUSH      1
-#define HWCAP_SPARC_STBAR      2
-#define HWCAP_SPARC_SWAP       4
-#define HWCAP_SPARC_MULDIV     8
-#define HWCAP_SPARC_V9         16
-#define HWCAP_SPARC_ULTRA3     32
-#define HWCAP_SPARC_BLKINIT    64
-#define HWCAP_SPARC_N2         128
-
-
-
-
-
 #define EF_MIPS_NOREORDER   1
 #define EF_MIPS_PIC        2
 #define EF_MIPS_CPIC       4
@@ -1139,9 +1162,10 @@ typedef struct {
 #define EF_MIPS_ARCH_3     0x20000000
 #define EF_MIPS_ARCH_4     0x30000000
 #define EF_MIPS_ARCH_5     0x40000000
-#define EF_MIPS_ARCH_32            0x60000000
-#define EF_MIPS_ARCH_64            0x70000000
-
+#define EF_MIPS_ARCH_32     0x50000000
+#define EF_MIPS_ARCH_64     0x60000000
+#define EF_MIPS_ARCH_32R2   0x70000000
+#define EF_MIPS_ARCH_64R2   0x80000000
 
 
 #define E_MIPS_ARCH_1    0x00000000
@@ -1149,8 +1173,8 @@ typedef struct {
 #define E_MIPS_ARCH_3    0x20000000
 #define E_MIPS_ARCH_4    0x30000000
 #define E_MIPS_ARCH_5    0x40000000
-#define E_MIPS_ARCH_32   0x60000000
-#define E_MIPS_ARCH_64   0x70000000
+#define E_MIPS_ARCH_32   0x50000000
+#define E_MIPS_ARCH_64   0x60000000
 
 
 
@@ -2020,7 +2044,8 @@ typedef Elf32_Addr Elf32_Conflict;
 #define EF_ARM_VFP_FLOAT       0x400
 #define EF_ARM_MAVERICK_FLOAT  0x800
 
-
+#define EF_ARM_ABI_FLOAT_SOFT  0x200
+#define EF_ARM_ABI_FLOAT_HARD  0x400
 
 
 #define EF_ARM_SYMSARESORTED   0x04
@@ -2064,6 +2089,17 @@ typedef Elf32_Addr Elf32_Conflict;
 #define SHT_ARM_ATTRIBUTES     (SHT_LOPROC + 3)
 
 
+#define R_AARCH64_NONE            0
+#define R_AARCH64_ABS64         257
+#define R_AARCH64_ABS32         258
+#define R_AARCH64_COPY         1024
+#define R_AARCH64_GLOB_DAT     1025
+#define R_AARCH64_JUMP_SLOT    1026
+#define R_AARCH64_RELATIVE     1027
+#define R_AARCH64_TLS_DTPMOD64 1028
+#define R_AARCH64_TLS_DTPREL64 1029
+#define R_AARCH64_TLS_TPREL64  1030
+#define R_AARCH64_TLSDESC      1031
 
 
 #define R_ARM_NONE             0
@@ -2079,7 +2115,7 @@ typedef Elf32_Addr Elf32_Conflict;
 #define R_ARM_THM_PC22         10
 #define R_ARM_THM_PC8          11
 #define R_ARM_AMP_VCALL9       12
-#define R_ARM_SWI24            13
+#define R_ARM_TLS_DESC         13
 #define R_ARM_THM_SWI8         14
 #define R_ARM_XPC25            15
 #define R_ARM_THM_XPC22                16
@@ -2094,12 +2130,78 @@ typedef Elf32_Addr Elf32_Conflict;
 #define R_ARM_GOTPC            25
 #define R_ARM_GOT32            26
 #define R_ARM_PLT32            27
+#define R_ARM_CALL             28
+#define R_ARM_JUMP24           29
+#define R_ARM_THM_JUMP24       30
+#define R_ARM_BASE_ABS         31
 #define R_ARM_ALU_PCREL_7_0    32
 #define R_ARM_ALU_PCREL_15_8   33
 #define R_ARM_ALU_PCREL_23_15  34
 #define R_ARM_LDR_SBREL_11_0   35
 #define R_ARM_ALU_SBREL_19_12  36
 #define R_ARM_ALU_SBREL_27_20  37
+#define R_ARM_TARGET1          38
+#define R_ARM_SBREL31          39
+#define R_ARM_V4BX             40
+#define R_ARM_TARGET2          41
+#define R_ARM_PREL31           42
+#define R_ARM_MOVW_ABS_NC      43
+#define R_ARM_MOVT_ABS         44
+#define R_ARM_MOVW_PREL_NC     45
+#define R_ARM_MOVT_PREL                46
+#define R_ARM_THM_MOVW_ABS_NC  47
+#define R_ARM_THM_MOVT_ABS     48
+#define R_ARM_THM_MOVW_PREL_NC 49
+#define R_ARM_THM_MOVT_PREL    50
+#define R_ARM_THM_JUMP19       51
+#define R_ARM_THM_JUMP6                52
+#define R_ARM_THM_ALU_PREL_11_0        53
+#define R_ARM_THM_PC12         54
+#define R_ARM_ABS32_NOI                55
+#define R_ARM_REL32_NOI                56
+#define R_ARM_ALU_PC_G0_NC     57
+#define R_ARM_ALU_PC_G0                58
+#define R_ARM_ALU_PC_G1_NC     59
+#define R_ARM_ALU_PC_G1                60
+#define R_ARM_ALU_PC_G2                61
+#define R_ARM_LDR_PC_G1                62
+#define R_ARM_LDR_PC_G2                63
+#define R_ARM_LDRS_PC_G0       64
+#define R_ARM_LDRS_PC_G1       65
+#define R_ARM_LDRS_PC_G2       66
+#define R_ARM_LDC_PC_G0                67
+#define R_ARM_LDC_PC_G1                68
+#define R_ARM_LDC_PC_G2                69
+#define R_ARM_ALU_SB_G0_NC     70
+#define R_ARM_ALU_SB_G0                71
+#define R_ARM_ALU_SB_G1_NC     72
+#define R_ARM_ALU_SB_G1                73
+#define R_ARM_ALU_SB_G2                74
+#define R_ARM_LDR_SB_G0                75
+#define R_ARM_LDR_SB_G1                76
+#define R_ARM_LDR_SB_G2                77
+#define R_ARM_LDRS_SB_G0       78
+#define R_ARM_LDRS_SB_G1       79
+#define R_ARM_LDRS_SB_G2       80
+#define R_ARM_LDC_SB_G0                81
+#define R_ARM_LDC_SB_G1                82
+#define R_ARM_LDC_SB_G2                83
+#define R_ARM_MOVW_BREL_NC     84
+#define R_ARM_MOVT_BREL                85
+#define R_ARM_MOVW_BREL                86
+#define R_ARM_THM_MOVW_BREL_NC 87
+#define R_ARM_THM_MOVT_BREL    88
+#define R_ARM_THM_MOVW_BREL    89
+#define R_ARM_TLS_GOTDESC      90
+#define R_ARM_TLS_CALL         91
+#define R_ARM_TLS_DESCSEQ      92
+#define R_ARM_THM_TLS_CALL     93
+#define R_ARM_PLT32_ABS                94
+#define R_ARM_GOT_ABS          95
+#define R_ARM_GOT_PREL         96
+#define R_ARM_GOT_BREL12       97
+#define R_ARM_GOTOFF12         98
+#define R_ARM_GOTRELAX         99
 #define R_ARM_GNU_VTENTRY      100
 #define R_ARM_GNU_VTINHERIT    101
 #define R_ARM_THM_PC11         102
@@ -2113,7 +2215,15 @@ typedef Elf32_Addr Elf32_Conflict;
 #define R_ARM_TLS_IE32         107
 
 #define R_ARM_TLS_LE32         108
-
+#define R_ARM_TLS_LDO12                109
+#define R_ARM_TLS_LE12         110
+#define R_ARM_TLS_IE12GP       111
+#define R_ARM_ME_TOO           128
+#define R_ARM_THM_TLS_DESCSEQ  129
+#define R_ARM_THM_TLS_DESCSEQ16        129
+#define R_ARM_THM_TLS_DESCSEQ32        130
+#define R_ARM_THM_GOT_BREL12   131
+#define R_ARM_IRELATIVE                160
 #define R_ARM_RXPC25           249
 #define R_ARM_RSBREL32         250
 #define R_ARM_THM_RPC22                251
@@ -2421,15 +2531,21 @@ typedef Elf32_Addr Elf32_Conflict;
 #define R_X86_64_PC64          24
 #define R_X86_64_GOTOFF64      25
 #define R_X86_64_GOTPC32       26
-
+#define R_X86_64_GOT64         27
+#define R_X86_64_GOTPCREL64    28
+#define R_X86_64_GOTPC64       29
+#define R_X86_64_GOTPLT64      30
+#define R_X86_64_PLTOFF64      31
+#define R_X86_64_SIZE32                32
+#define R_X86_64_SIZE64                33
 
 #define R_X86_64_GOTPC32_TLSDESC 34
 #define R_X86_64_TLSDESC_CALL   35
 
 #define R_X86_64_TLSDESC        36
 #define R_X86_64_IRELATIVE     37
-
-#define R_X86_64_NUM           38
+#define R_X86_64_RELATIVE64    38
+#define R_X86_64_NUM           39