8#ifndef ZEPHYR_LLEXT_ELF_H
9#define ZEPHYR_LLEXT_ELF_H
199#define SHT_PROGBITS 0x1
200#define SHT_SYMTAB 0x2
201#define SHT_STRTAB 0x3
203#define SHT_NOBITS 0x8
205#define SHT_DYNSYM 0xB
209#define SHF_EXECINSTR 0x4
248#define SHN_ABS 0xfff1
249#define SHN_COMMON 0xfff2
275#define ELF32_ST_BIND(i) ((i) >> 4)
282#define ELF32_ST_TYPE(i) ((i) & 0xf)
289#define ELF64_ST_BIND(i) ((i) >> 4)
297#define ELF64_ST_TYPE(i) ((i) & 0xf)
321#define ELF32_R_SYM(i) ((i) >> 8)
328#define ELF32_R_TYPE(i) ((i) & 0xff)
350#define ELF64_R_SYM(i) ((i) >> 32)
357#define ELF64_R_TYPE(i) ((i) & 0xffffffff)
365#define R_386_GLOB_DAT 6
366#define R_386_JMP_SLOT 7
367#define R_386_RELATIVE 8
368#define R_386_GOTOFF 9
375#define R_ARM_GLOB_DAT 21
376#define R_ARM_JUMP_SLOT 22
377#define R_ARM_RELATIVE 23
379#define R_ARM_JUMP24 29
380#define R_ARM_TARGET1 38
382#define R_ARM_PREL31 42
383#define R_ARM_MOVW_ABS_NC 43
384#define R_ARM_MOVT_ABS 44
385#define R_ARM_MOVW_PREL_NC 45
386#define R_ARM_MOVT_PREL 46
387#define R_ARM_ALU_PC_G0_NC 57
388#define R_ARM_ALU_PC_G1_NC 59
389#define R_ARM_LDR_PC_G2 63
391#define R_ARM_THM_CALL 10
392#define R_ARM_THM_JUMP24 30
393#define R_ARM_THM_MOVW_ABS_NC 47
394#define R_ARM_THM_MOVT_ABS 48
395#define R_ARM_THM_MOVW_PREL_NC 49
396#define R_ARM_THM_MOVT_PREL 50
398#define R_XTENSA_NONE 0
400#define R_XTENSA_SLOT0_OP 20
457#if defined(CONFIG_64BIT) || defined(__DOXYGEN__)
476#define ELF_R_SYM ELF64_R_SYM
478#define ELF_R_TYPE ELF64_R_TYPE
480#define ELF_ST_BIND ELF64_ST_BIND
482#define ELF_ST_TYPE ELF64_ST_TYPE
502#define ELF_R_SYM ELF32_R_SYM
504#define ELF_R_TYPE ELF32_R_TYPE
506#define ELF_ST_BIND ELF32_ST_BIND
508#define ELF_ST_TYPE ELF32_ST_TYPE
int32_t elf32_sword
Signed integer.
Definition: elf.h:34
uint16_t elf32_half
Unsigned medium integer.
Definition: elf.h:30
elf64_xword elf_word
Machine sized integer.
Definition: elf.h:469
int32_t elf64_sword
Signed integer.
Definition: elf.h:45
uint16_t elf64_half
Unsigned medium integer.
Definition: elf.h:41
int64_t elf64_sxword
Signed long integer.
Definition: elf.h:49
uint64_t elf64_addr
Unsigned program address.
Definition: elf.h:39
uint32_t elf32_addr
Unsigned program address.
Definition: elf.h:28
uint64_t elf64_xword
Unsigned long integer.
Definition: elf.h:51
uint64_t elf64_off
Unsigned file offset.
Definition: elf.h:43
elf64_addr elf_addr
Machine sized program address.
Definition: elf.h:465
uint32_t elf64_word
Unsigned integer.
Definition: elf.h:47
uint32_t elf32_off
Unsigned file offset.
Definition: elf.h:32
uint32_t elf32_word
Unsigned integer.
Definition: elf.h:36
elf64_half elf_half
Machine sized small integer.
Definition: elf.h:467
#define EI_NIDENT
ELF identifier block.
Definition: elf.h:65
__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
Dynamic section entry(32-bit)
Definition: elf.h:438
elf32_sword d_tag
Definition: elf.h:439
union elf32_dyn::@260 d_un
elf32_addr d_ptr
Definition: elf.h:442
elf32_word d_val
Definition: elf.h:441
ELF Header(32-bit)
Definition: elf.h:70
elf32_off e_shoff
Section header table offset.
Definition: elf.h:84
elf32_half e_machine
Machine type.
Definition: elf.h:76
elf32_half e_phentsize
Program header count.
Definition: elf.h:90
elf32_word e_flags
Processor specific flags.
Definition: elf.h:86
elf32_addr e_entry
Virtual address of entry.
Definition: elf.h:80
elf32_half e_phnum
Program header count.
Definition: elf.h:92
elf32_half e_shentsize
Section header size.
Definition: elf.h:94
elf32_half e_ehsize
ELF header size.
Definition: elf.h:88
elf32_half e_shstrndx
Section header containing section header string table.
Definition: elf.h:98
elf32_word e_version
Object file version.
Definition: elf.h:78
elf32_half e_shnum
Section header count.
Definition: elf.h:96
unsigned char e_ident[16]
Magic string identifying ELF binary.
Definition: elf.h:72
elf32_half e_type
Type of ELF.
Definition: elf.h:74
elf32_off e_phoff
Program header table offset.
Definition: elf.h:82
Program header(32-bit)
Definition: elf.h:405
elf32_word p_flags
Definition: elf.h:412
elf32_addr p_paddr
Definition: elf.h:409
elf32_word p_memsz
Definition: elf.h:411
elf32_off p_offset
Definition: elf.h:407
elf32_addr p_vaddr
Definition: elf.h:408
elf32_word p_align
Definition: elf.h:413
elf32_word p_type
Definition: elf.h:406
elf32_word p_filesz
Definition: elf.h:410
Relocation entry for 32-bit ELFs.
Definition: elf.h:302
elf32_addr r_offset
Offset in the section to perform a relocation.
Definition: elf.h:304
elf32_word r_info
Information about the relocation, related symbol and type.
Definition: elf.h:307
elf32_sword r_addend
Definition: elf.h:313
elf32_word r_info
Definition: elf.h:312
elf32_addr r_offset
Definition: elf.h:311
Section Header(32-bit)
Definition: elf.h:150
elf32_addr sh_addr
Address of section in the image.
Definition: elf.h:158
elf32_word sh_name
Section header name index in section header string table.
Definition: elf.h:152
elf32_word sh_type
Section type.
Definition: elf.h:154
elf32_word sh_flags
Section header attributes.
Definition: elf.h:156
elf32_word sh_size
Section size in bytes.
Definition: elf.h:162
elf32_word sh_info
Section info, depends on section type.
Definition: elf.h:166
elf32_word sh_addralign
Section address alignment.
Definition: elf.h:168
elf32_off sh_offset
Location of section in the ELF binary in bytes.
Definition: elf.h:160
elf32_word sh_entsize
Section contains table of fixed size entries sh_entsize bytes large.
Definition: elf.h:170
elf32_word sh_link
Section header table link index, depends on section type.
Definition: elf.h:164
Symbol table entry(32-bit)
Definition: elf.h:214
elf32_half st_shndx
Symbols related section given by section header index.
Definition: elf.h:226
elf32_word st_name
Name of the symbol as an index into the symbol string table.
Definition: elf.h:216
elf32_addr st_value
Value or location of the symbol.
Definition: elf.h:218
unsigned char st_other
Symbol visibility.
Definition: elf.h:224
unsigned char st_info
Symbol binding and type information.
Definition: elf.h:222
elf32_word st_size
Size of the symbol.
Definition: elf.h:220
Dynamic section entry(64-bit)
Definition: elf.h:449
elf64_sxword d_tag
Definition: elf.h:450
union elf64_dyn::@261 d_un
elf64_addr d_ptr
Definition: elf.h:453
elf64_xword d_val
Definition: elf.h:452
ELF Header(64-bit)
Definition: elf.h:104
elf64_addr e_entry
Virtual address of entry.
Definition: elf.h:114
elf64_off e_shoff
Section header table offset.
Definition: elf.h:118
elf64_half e_shentsize
Section header size.
Definition: elf.h:128
elf64_half e_phnum
Program header count.
Definition: elf.h:126
elf64_half e_shstrndx
Section header containing section header string table.
Definition: elf.h:132
elf64_half e_phentsize
Program header size.
Definition: elf.h:124
elf64_word e_flags
Processor specific flags.
Definition: elf.h:120
elf64_half e_ehsize
ELF header size.
Definition: elf.h:122
elf64_word e_version
Object file version.
Definition: elf.h:112
elf64_half e_type
Type of ELF.
Definition: elf.h:108
elf64_off e_phoff
Program header table offset.
Definition: elf.h:116
elf64_half e_machine
Machine type.
Definition: elf.h:110
unsigned char e_ident[16]
Magic string identifying ELF binary.
Definition: elf.h:106
elf64_half e_shnum
Section header count.
Definition: elf.h:130
Program header(64-bit)
Definition: elf.h:419
elf64_xword p_filesz
Definition: elf.h:424
elf64_addr p_vaddr
Definition: elf.h:422
elf64_word p_type
Definition: elf.h:420
elf64_addr p_paddr
Definition: elf.h:423
elf64_word p_flags
Definition: elf.h:426
elf64_xword p_align
Definition: elf.h:427
elf64_xword p_memsz
Definition: elf.h:425
elf64_off p_offset
Definition: elf.h:421
Relocation entry for 64-bit ELFs.
Definition: elf.h:333
elf64_addr r_offset
Offset in section to perform a relocation.
Definition: elf.h:335
elf64_xword r_info
Information about relocation, related symbol and type.
Definition: elf.h:337
elf64_sxword r_addend
Definition: elf.h:343
elf64_addr r_offset
Definition: elf.h:341
elf64_xword r_info
Definition: elf.h:342
Section Header(64-bit)
Definition: elf.h:176
elf64_xword sh_size
Section size in bytes.
Definition: elf.h:188
elf64_xword sh_entsize
Section contains table of fixed size entries sh_entsize bytes large.
Definition: elf.h:196
elf64_word sh_link
Section header table link index, depends on section type.
Definition: elf.h:190
elf64_addr sh_addr
Address of section in the image.
Definition: elf.h:184
elf64_off sh_offset
Location of section in the ELF binary in bytes.
Definition: elf.h:186
elf64_xword sh_addralign
Section address alignment.
Definition: elf.h:194
elf64_word sh_info
Section info, depends on section type.
Definition: elf.h:192
elf64_xword sh_flags
Section header attributes.
Definition: elf.h:182
elf64_word sh_type
Section type.
Definition: elf.h:180
elf64_word sh_name
Section header name index in section header string table.
Definition: elf.h:178
Symbol table entry(64-bit)
Definition: elf.h:232
elf64_half st_shndx
Symbols related section given by section header index.
Definition: elf.h:240
elf64_addr st_value
Value or location of the symbol.
Definition: elf.h:242
unsigned char st_other
Symbol visibility.
Definition: elf.h:238
unsigned char st_info
Symbol binding and type information.
Definition: elf.h:236
elf64_xword st_size
Size of the symbol.
Definition: elf.h:244
elf64_word st_name
Name of the symbol as an index into the symbol string table.
Definition: elf.h:234