8#ifndef ZEPHYR_LLEXT_ELF_H
9#define ZEPHYR_LLEXT_ELF_H
202#define SHT_PROGBITS 0x1
203#define SHT_SYMTAB 0x2
204#define SHT_STRTAB 0x3
206#define SHT_NOBITS 0x8
208#define SHT_DYNSYM 0xB
213#define SHF_EXECINSTR 0x4
253#define SHN_LORESERVE 0xff00
254#define SHN_ABS 0xfff1
255#define SHN_COMMON 0xfff2
256#define SHN_HIRESERVE 0xffff
284#define ELF32_ST_BIND(i) ((i) >> 4)
291#define ELF32_ST_TYPE(i) ((i) & 0xf)
298#define ELF64_ST_BIND(i) ((i) >> 4)
306#define ELF64_ST_TYPE(i) ((i) & 0xf)
341#define ELF32_R_SYM(i) ((i) >> 8)
348#define ELF32_R_TYPE(i) ((i) & 0xff)
382#define ELF64_R_SYM(i) ((i) >> 32)
389#define ELF64_R_TYPE(i) ((i) & 0xffffffff)
401#define R_386_GLOB_DAT 6
402#define R_386_JMP_SLOT 7
403#define R_386_RELATIVE 8
404#define R_386_GOTOFF 9
411#define R_ARM_GLOB_DAT 21
412#define R_ARM_JUMP_SLOT 22
413#define R_ARM_RELATIVE 23
415#define R_ARM_JUMP24 29
416#define R_ARM_TARGET1 38
418#define R_ARM_PREL31 42
419#define R_ARM_MOVW_ABS_NC 43
420#define R_ARM_MOVT_ABS 44
421#define R_ARM_MOVW_PREL_NC 45
422#define R_ARM_MOVT_PREL 46
423#define R_ARM_ALU_PC_G0_NC 57
424#define R_ARM_ALU_PC_G1_NC 59
425#define R_ARM_LDR_PC_G2 63
427#define R_ARM_THM_CALL 10
428#define R_ARM_THM_JUMP24 30
429#define R_ARM_THM_MOVW_ABS_NC 47
430#define R_ARM_THM_MOVT_ABS 48
431#define R_ARM_THM_MOVW_PREL_NC 49
432#define R_ARM_THM_MOVT_PREL 50
434#define R_XTENSA_NONE 0
436#define R_XTENSA_SLOT0_OP 20
500#if defined(CONFIG_64BIT) || defined(__DOXYGEN__)
520#define ELF_R_SYM ELF64_R_SYM
522#define ELF_R_TYPE ELF64_R_TYPE
524#define ELF_ST_BIND ELF64_ST_BIND
526#define ELF_ST_TYPE ELF64_ST_TYPE
547#define ELF_R_SYM ELF32_R_SYM
549#define ELF_R_TYPE ELF32_R_TYPE
551#define ELF_ST_BIND ELF32_ST_BIND
553#define ELF_ST_TYPE ELF32_ST_TYPE
int32_t elf32_sword
Signed integer.
Definition: elf.h:35
uint16_t elf32_half
Unsigned medium integer.
Definition: elf.h:31
elf64_xword elf_word
Machine sized integer.
Definition: elf.h:512
int32_t elf64_sword
Signed integer.
Definition: elf.h:46
uint16_t elf64_half
Unsigned medium integer.
Definition: elf.h:42
int64_t elf64_sxword
Signed long integer.
Definition: elf.h:50
uint64_t elf64_addr
Unsigned program address.
Definition: elf.h:40
uint32_t elf32_addr
Unsigned program address.
Definition: elf.h:29
uint64_t elf64_xword
Unsigned long integer.
Definition: elf.h:52
uint64_t elf64_off
Unsigned file offset.
Definition: elf.h:44
elf64_addr elf_addr
Machine sized program address.
Definition: elf.h:508
uint32_t elf64_word
Unsigned integer.
Definition: elf.h:48
uint32_t elf32_off
Unsigned file offset.
Definition: elf.h:33
uint32_t elf32_word
Unsigned integer.
Definition: elf.h:37
elf64_half elf_half
Machine sized small integer.
Definition: elf.h:510
struct elf64_phdr elf_phdr_t
Machine sized program header structure.
Definition: elf.h:506
#define EI_NIDENT
ELF identifier block.
Definition: elf.h:66
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__INT32_TYPE__ int32_t
Definition: stdint.h:74
__UINT64_TYPE__ uint64_t
Definition: stdint.h:91
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
__INT64_TYPE__ int64_t
Definition: stdint.h:75
ELF Header(32-bit)
Definition: elf.h:71
elf32_off e_shoff
Section header table offset.
Definition: elf.h:85
elf32_half e_machine
Machine type.
Definition: elf.h:77
elf32_half e_phentsize
Program header count.
Definition: elf.h:91
elf32_word e_flags
Processor specific flags.
Definition: elf.h:87
elf32_addr e_entry
Virtual address of entry.
Definition: elf.h:81
elf32_half e_phnum
Program header count.
Definition: elf.h:93
elf32_half e_shentsize
Section header size.
Definition: elf.h:95
elf32_half e_ehsize
ELF header size.
Definition: elf.h:89
elf32_half e_shstrndx
Section header containing section header string table.
Definition: elf.h:99
elf32_word e_version
Object file version.
Definition: elf.h:79
elf32_half e_shnum
Section header count.
Definition: elf.h:97
unsigned char e_ident[16]
Magic string identifying ELF binary.
Definition: elf.h:73
elf32_half e_type
Type of ELF.
Definition: elf.h:75
elf32_off e_phoff
Program header table offset.
Definition: elf.h:83
Relocation entry for 32-bit ELFs.
Definition: elf.h:315
elf32_addr r_offset
Offset in the section to perform a relocation.
Definition: elf.h:317
elf32_word r_info
Information about the relocation, related symbol and type.
Definition: elf.h:319
Relocation entry for 32-bit ELFs with addend.
Definition: elf.h:327
elf32_sword r_addend
Offset to be applied to the symbol address.
Definition: elf.h:333
elf32_word r_info
Information about the relocation, related symbol and type.
Definition: elf.h:331
elf32_addr r_offset
Offset in the section to perform a relocation.
Definition: elf.h:329
Section Header(32-bit)
Definition: elf.h:151
elf32_addr sh_addr
Address of section in the image.
Definition: elf.h:159
elf32_word sh_name
Section header name index in section header string table.
Definition: elf.h:153
elf32_word sh_type
Section type.
Definition: elf.h:155
elf32_word sh_flags
Section header attributes.
Definition: elf.h:157
elf32_word sh_size
Section size in bytes.
Definition: elf.h:163
elf32_word sh_info
Section info, depends on section type.
Definition: elf.h:167
elf32_word sh_addralign
Section address alignment.
Definition: elf.h:169
elf32_off sh_offset
Location of section in the ELF binary in bytes.
Definition: elf.h:161
elf32_word sh_entsize
Section contains table of fixed size entries sh_entsize bytes large.
Definition: elf.h:171
elf32_word sh_link
Section header table link index, depends on section type.
Definition: elf.h:165
Symbol table entry(32-bit)
Definition: elf.h:218
elf32_half st_shndx
Symbols related section given by section header index.
Definition: elf.h:230
elf32_word st_name
Name of the symbol as an index into the symbol string table.
Definition: elf.h:220
elf32_addr st_value
Value or location of the symbol.
Definition: elf.h:222
unsigned char st_other
Symbol visibility.
Definition: elf.h:228
unsigned char st_info
Symbol binding and type information.
Definition: elf.h:226
elf32_word st_size
Size of the symbol.
Definition: elf.h:224
ELF Header(64-bit)
Definition: elf.h:105
elf64_addr e_entry
Virtual address of entry.
Definition: elf.h:115
elf64_off e_shoff
Section header table offset.
Definition: elf.h:119
elf64_half e_shentsize
Section header size.
Definition: elf.h:129
elf64_half e_phnum
Program header count.
Definition: elf.h:127
elf64_half e_shstrndx
Section header containing section header string table.
Definition: elf.h:133
elf64_half e_phentsize
Program header size.
Definition: elf.h:125
elf64_word e_flags
Processor specific flags.
Definition: elf.h:121
elf64_half e_ehsize
ELF header size.
Definition: elf.h:123
elf64_word e_version
Object file version.
Definition: elf.h:113
elf64_half e_type
Type of ELF.
Definition: elf.h:109
elf64_off e_phoff
Program header table offset.
Definition: elf.h:117
elf64_half e_machine
Machine type.
Definition: elf.h:111
unsigned char e_ident[16]
Magic string identifying ELF binary.
Definition: elf.h:107
elf64_half e_shnum
Section header count.
Definition: elf.h:131
Relocation entry for 64-bit ELFs.
Definition: elf.h:357
elf64_addr r_offset
Offset in the section to perform a relocation.
Definition: elf.h:359
elf64_xword r_info
Information about the relocation, related symbol and type.
Definition: elf.h:361
Relocation entry for 64-bit ELFs with addend.
Definition: elf.h:369
elf64_sxword r_addend
Offset to be applied to the symbol address.
Definition: elf.h:375
elf64_addr r_offset
Offset in the section to perform a relocation.
Definition: elf.h:371
elf64_xword r_info
Information about the relocation, related symbol and type.
Definition: elf.h:373
Section Header(64-bit)
Definition: elf.h:177
elf64_xword sh_size
Section size in bytes.
Definition: elf.h:189
elf64_xword sh_entsize
Section contains table of fixed size entries sh_entsize bytes large.
Definition: elf.h:197
elf64_word sh_link
Section header table link index, depends on section type.
Definition: elf.h:191
elf64_addr sh_addr
Address of section in the image.
Definition: elf.h:185
elf64_off sh_offset
Location of section in the ELF binary in bytes.
Definition: elf.h:187
elf64_xword sh_addralign
Section address alignment.
Definition: elf.h:195
elf64_word sh_info
Section info, depends on section type.
Definition: elf.h:193
elf64_xword sh_flags
Section header attributes.
Definition: elf.h:183
elf64_word sh_type
Section type.
Definition: elf.h:181
elf64_word sh_name
Section header name index in section header string table.
Definition: elf.h:179
Symbol table entry(64-bit)
Definition: elf.h:236
elf64_half st_shndx
Symbols related section given by section header index.
Definition: elf.h:244
elf64_addr st_value
Value or location of the symbol.
Definition: elf.h:246
unsigned char st_other
Symbol visibility.
Definition: elf.h:242
unsigned char st_info
Symbol binding and type information.
Definition: elf.h:240
elf64_xword st_size
Size of the symbol.
Definition: elf.h:248
elf64_word st_name
Name of the symbol as an index into the symbol string table.
Definition: elf.h:238