4 #include "output/elfcommon.h"
6 /* ELF standard typedefs (yet more proof that <stdint.h> was way overdue) */
7 typedef uint16_t Elf32_Half
;
8 typedef int16_t Elf32_SHalf
;
9 typedef uint32_t Elf32_Word
;
10 typedef int32_t Elf32_Sword
;
11 typedef uint64_t Elf32_Xword
;
12 typedef int64_t Elf32_Sxword
;
14 typedef uint32_t Elf32_Off
;
15 typedef uint32_t Elf32_Addr
;
16 typedef uint16_t Elf32_Section
;
20 typedef struct elf32_dyn
{
30 #define ELF32_R_SYM(x) ((x) >> 8)
31 #define ELF32_R_TYPE(x) ((x) & 0xff)
33 typedef struct elf32_rel
{
38 typedef struct elf32_rela
{
45 R_386_32
= 1, /* ordinary absolute relocation */
46 R_386_PC32
= 2, /* PC-relative relocation */
47 R_386_GOT32
= 3, /* an offset into GOT */
48 R_386_PLT32
= 4, /* a PC-relative offset into PLT */
49 R_386_COPY
= 5, /* ??? */
50 R_386_GLOB_DAT
= 6, /* ??? */
51 R_386_JUMP_SLOT
= 7, /* ??? */
52 R_386_RELATIVE
= 8, /* ??? */
53 R_386_GOTOFF
= 9, /* an offset from GOT base */
54 R_386_GOTPC
= 10, /* a PC-relative offset _to_ GOT */
55 R_386_TLS_TPOFF
= 14, /* Offset in static TLS block */
56 R_386_TLS_IE
= 15, /* Address of GOT entry for static TLS
58 /* These are GNU extensions, but useful */
59 R_386_16
= 20, /* A 16-bit absolute relocation */
60 R_386_PC16
= 21, /* A 16-bit PC-relative relocation */
61 R_386_8
= 22, /* An 8-bit absolute relocation */
62 R_386_PC8
= 23 /* An 8-bit PC-relative relocation */
67 typedef struct elf32_sym
{
71 unsigned char st_info
;
72 unsigned char st_other
;
76 /* Main file header */
78 typedef struct elf32_hdr
{
79 unsigned char e_ident
[EI_NIDENT
];
88 Elf32_Half e_phentsize
;
90 Elf32_Half e_shentsize
;
92 Elf32_Half e_shstrndx
;
97 typedef struct elf32_phdr
{
110 typedef struct elf32_shdr
{
119 Elf32_Word sh_addralign
;
120 Elf32_Word sh_entsize
;
124 typedef struct elf32_note
{
125 Elf32_Word n_namesz
; /* Name size */
126 Elf32_Word n_descsz
; /* Content size */
127 Elf32_Word n_type
; /* Content type */
130 /* How to extract and insert information held in the st_info field. */
131 #define ELF32_ST_BIND(val) (((unsigned char) (val)) >> 4)
132 #define ELF32_ST_TYPE(val) ((val) & 0xf)
134 #endif /* OUTPUT_ELF32_H */