Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

ELF types and parsing. More...

Data Structures

struct  elf32_ehdr
 ELF Header(32-bit) More...
 
struct  elf64_ehdr
 ELF Header(64-bit) More...
 
struct  elf32_shdr
 Section Header(32-bit) More...
 
struct  elf64_shdr
 Section Header(64-bit) More...
 
struct  elf32_sym
 Symbol table entry(32-bit) More...
 
struct  elf64_sym
 Symbol table entry(64-bit) More...
 
struct  elf32_rel
 Relocation entry for 32-bit ELFs. More...
 
struct  elf32_rela
 
struct  elf64_rel
 Relocation entry for 64-bit ELFs. More...
 
struct  elf64_rela
 
struct  elf32_phdr
 Program header(32-bit) More...
 
struct  elf64_phdr
 Program header(64-bit) More...
 
struct  elf32_dyn
 Dynamic section entry(32-bit) More...
 
struct  elf64_dyn
 Dynamic section entry(64-bit) More...
 

Macros

#define EI_NIDENT   16
 ELF identifier block.
 
#define ET_REL   1
 Relocatable (unlinked) ELF.
 
#define ET_EXEC   2
 Executable (without PIC/PIE) ELF.
 
#define ET_DYN   3
 Dynamic (executable with PIC/PIE or shared lib) ELF.
 
#define ET_CORE   4
 Core Dump.
 
#define SHT_PROGBITS   0x1
 
#define SHT_SYMTAB   0x2
 
#define SHT_STRTAB   0x3
 
#define SHT_RELA   0x4
 
#define SHT_NOBITS   0x8
 
#define SHT_REL   0x9
 
#define SHT_DYNSYM   0xB
 
#define SHF_WRITE   0x1
 
#define SHF_ALLOC   0x2
 
#define SHF_EXECINSTR   0x4
 
#define SHN_UNDEF   0
 
#define SHN_ABS   0xfff1
 
#define SHN_COMMON   0xfff2
 
#define STT_NOTYPE   0
 
#define STT_OBJECT   1
 
#define STT_FUNC   2
 
#define STT_SECTION   3
 
#define STT_FILE   4
 
#define STT_COMMON   5
 
#define STT_LOOS   10
 
#define STT_HIOS   12
 
#define STT_LOPROC   13
 
#define STT_HIPROC   15
 
#define STB_LOCAL   0
 
#define STB_GLOBAL   1
 
#define STB_WEAK   2
 
#define STB_LOOS   10
 
#define STB_HIOS   12
 
#define STB_LOPROC   13
 
#define STB_HIPROC   15
 
#define ELF32_ST_BIND(i)   ((i) >> 4)
 Symbol binding from 32bit st_info.
 
#define ELF32_ST_TYPE(i)   ((i) & 0xf)
 Symbol type from 32bit st_info.
 
#define ELF64_ST_BIND(i)   ((i) >> 4)
 Symbol binding from 32bit st_info.
 
#define ELF64_ST_TYPE(i)   ((i) & 0xf)
 Symbol type from 32bit st_info.
 
#define ELF32_R_SYM(i)   ((i) >> 8)
 Relocation symbol index from r_info.
 
#define ELF32_R_TYPE(i)   ((i) & 0xff)
 Relocation type from r_info.
 
#define ELF64_R_SYM(i)   ((i) >> 32)
 Relocation symbol from r_info.
 
#define ELF64_R_TYPE(i)   ((i) & 0xffffffff)
 Relocation type from r_info.
 
#define R_386_NONE   0
 
#define R_386_32   1
 
#define R_386_PC32   2
 
#define R_386_GOT32   3
 
#define R_386_PLT32   4
 
#define R_386_COPY   5
 
#define R_386_GLOB_DAT   6
 
#define R_386_JMP_SLOT   7
 
#define R_386_RELATIVE   8
 
#define R_386_GOTOFF   9
 
#define R_ARM_NONE   0
 
#define R_ARM_PC24   1
 
#define R_ARM_ABS32   2
 
#define R_ARM_REL32   3
 
#define R_ARM_COPY   20
 
#define R_ARM_GLOB_DAT   21
 
#define R_ARM_JUMP_SLOT   22
 
#define R_ARM_RELATIVE   23
 
#define R_ARM_CALL   28
 
#define R_ARM_JUMP24   29
 
#define R_ARM_TARGET1   38
 
#define R_ARM_V4BX   40
 
#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_ALU_PC_G0_NC   57
 
#define R_ARM_ALU_PC_G1_NC   59
 
#define R_ARM_LDR_PC_G2   63
 
#define R_ARM_THM_CALL   10
 
#define R_ARM_THM_JUMP24   30
 
#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_XTENSA_NONE   0
 
#define R_XTENSA_32   1
 
#define R_XTENSA_SLOT0_OP   20
 
#define PT_LOAD   1
 Program segment type.
 
#define ELF_R_SYM   ELF64_R_SYM
 Machine sized macro alias for obtaining a relocation symbol.
 
#define ELF_R_TYPE   ELF64_R_TYPE
 Machine sized macro alias for obtaining a relocation type.
 
#define ELF_ST_BIND   ELF64_ST_BIND
 Machine sized macro alias for obtaining a symbol bind.
 
#define ELF_ST_TYPE   ELF64_ST_TYPE
 Machine sized macro alias for obtaining a symbol type.
 

Typedefs

typedef uint32_t elf32_addr
 Unsigned program address.
 
typedef uint16_t elf32_half
 Unsigned medium integer.
 
typedef uint32_t elf32_off
 Unsigned file offset.
 
typedef int32_t elf32_sword
 Signed integer.
 
typedef uint32_t elf32_word
 Unsigned integer.
 
typedef uint64_t elf64_addr
 Unsigned program address.
 
typedef uint16_t elf64_half
 Unsigned medium integer.
 
typedef uint64_t elf64_off
 Unsigned file offset.
 
typedef int32_t elf64_sword
 Signed integer.
 
typedef uint32_t elf64_word
 Unsigned integer.
 
typedef int64_t elf64_sxword
 Signed long integer.
 
typedef uint64_t elf64_xword
 Unsigned long integer.
 
typedef struct elf64_ehdr elf_ehdr_t
 Machine sized elf header structure.
 
typedef struct elf64_shdr elf_shdr_t
 Machine sized section header structure.
 
typedef struct elf64_phdr elf_phdr_t
 Machine sized program header structure.
 
typedef elf64_addr elf_addr
 Machine sized program address.
 
typedef elf64_half elf_half
 Machine sized small integer.
 
typedef elf64_xword elf_word
 Machine sized integer.
 
typedef struct elf64_rel elf_rel_t
 Machine sized relocation struct.
 
typedef struct elf64_rela elf_rela_t
 
typedef struct elf64_sym elf_sym_t
 Machine sized symbol struct.
 

Detailed Description

ELF types and parsing.

Reference documents can be found here https://refspecs.linuxfoundation.org/elf/

Macro Definition Documentation

◆ EI_NIDENT

#define EI_NIDENT   16

#include <zephyr/llext/elf.h>

ELF identifier block.

4 byte magic (.ELF) 1 byte class (Invalid, 32 bit, 64 bit) 1 byte endianness (Invalid, LSB, MSB) 1 byte version (1) 1 byte OS ABI (0 None, 1 HP-UX, 2 NetBSD, 3 Linux) 1 byte ABI (0) 7 bytes padding

◆ ELF32_R_SYM

#define ELF32_R_SYM (   i)    ((i) >> 8)

#include <zephyr/llext/elf.h>

Relocation symbol index from r_info.

Parameters
iValue of r_info

◆ ELF32_R_TYPE

#define ELF32_R_TYPE (   i)    ((i) & 0xff)

#include <zephyr/llext/elf.h>

Relocation type from r_info.

Parameters
iValue of r_info

◆ ELF32_ST_BIND

#define ELF32_ST_BIND (   i)    ((i) >> 4)

#include <zephyr/llext/elf.h>

Symbol binding from 32bit st_info.

Parameters
iValue of st_info

◆ ELF32_ST_TYPE

#define ELF32_ST_TYPE (   i)    ((i) & 0xf)

#include <zephyr/llext/elf.h>

Symbol type from 32bit st_info.

Parameters
iValue of st_info

◆ ELF64_R_SYM

#define ELF64_R_SYM (   i)    ((i) >> 32)

#include <zephyr/llext/elf.h>

Relocation symbol from r_info.

Parameters
iValue of r_info

◆ ELF64_R_TYPE

#define ELF64_R_TYPE (   i)    ((i) & 0xffffffff)

#include <zephyr/llext/elf.h>

Relocation type from r_info.

Parameters
iValue of r_info

◆ ELF64_ST_BIND

#define ELF64_ST_BIND (   i)    ((i) >> 4)

#include <zephyr/llext/elf.h>

Symbol binding from 32bit st_info.

Parameters
iValue of st_info

◆ ELF64_ST_TYPE

#define ELF64_ST_TYPE (   i)    ((i) & 0xf)

#include <zephyr/llext/elf.h>

Symbol type from 32bit st_info.

Parameters
iValue of st_info

◆ ELF_R_SYM

#define ELF_R_SYM   ELF64_R_SYM

#include <zephyr/llext/elf.h>

Machine sized macro alias for obtaining a relocation symbol.

◆ ELF_R_TYPE

#define ELF_R_TYPE   ELF64_R_TYPE

#include <zephyr/llext/elf.h>

Machine sized macro alias for obtaining a relocation type.

◆ ELF_ST_BIND

#define ELF_ST_BIND   ELF64_ST_BIND

#include <zephyr/llext/elf.h>

Machine sized macro alias for obtaining a symbol bind.

◆ ELF_ST_TYPE

#define ELF_ST_TYPE   ELF64_ST_TYPE

#include <zephyr/llext/elf.h>

Machine sized macro alias for obtaining a symbol type.

◆ ET_CORE

#define ET_CORE   4

#include <zephyr/llext/elf.h>

Core Dump.

◆ ET_DYN

#define ET_DYN   3

#include <zephyr/llext/elf.h>

Dynamic (executable with PIC/PIE or shared lib) ELF.

◆ ET_EXEC

#define ET_EXEC   2

#include <zephyr/llext/elf.h>

Executable (without PIC/PIE) ELF.

◆ ET_REL

#define ET_REL   1

#include <zephyr/llext/elf.h>

Relocatable (unlinked) ELF.

◆ PT_LOAD

#define PT_LOAD   1

#include <zephyr/llext/elf.h>

Program segment type.

◆ R_386_32

#define R_386_32   1

#include <zephyr/llext/elf.h>

◆ R_386_COPY

#define R_386_COPY   5

#include <zephyr/llext/elf.h>

◆ R_386_GLOB_DAT

#define R_386_GLOB_DAT   6

#include <zephyr/llext/elf.h>

◆ R_386_GOT32

#define R_386_GOT32   3

#include <zephyr/llext/elf.h>

◆ R_386_GOTOFF

#define R_386_GOTOFF   9

#include <zephyr/llext/elf.h>

◆ R_386_JMP_SLOT

#define R_386_JMP_SLOT   7

#include <zephyr/llext/elf.h>

◆ R_386_NONE

#define R_386_NONE   0

#include <zephyr/llext/elf.h>

◆ R_386_PC32

#define R_386_PC32   2

#include <zephyr/llext/elf.h>

◆ R_386_PLT32

#define R_386_PLT32   4

#include <zephyr/llext/elf.h>

◆ R_386_RELATIVE

#define R_386_RELATIVE   8

#include <zephyr/llext/elf.h>

◆ R_ARM_ABS32

#define R_ARM_ABS32   2

#include <zephyr/llext/elf.h>

◆ R_ARM_ALU_PC_G0_NC

#define R_ARM_ALU_PC_G0_NC   57

#include <zephyr/llext/elf.h>

◆ R_ARM_ALU_PC_G1_NC

#define R_ARM_ALU_PC_G1_NC   59

#include <zephyr/llext/elf.h>

◆ R_ARM_CALL

#define R_ARM_CALL   28

#include <zephyr/llext/elf.h>

◆ R_ARM_COPY

#define R_ARM_COPY   20

#include <zephyr/llext/elf.h>

◆ R_ARM_GLOB_DAT

#define R_ARM_GLOB_DAT   21

#include <zephyr/llext/elf.h>

◆ R_ARM_JUMP24

#define R_ARM_JUMP24   29

#include <zephyr/llext/elf.h>

◆ R_ARM_JUMP_SLOT

#define R_ARM_JUMP_SLOT   22

#include <zephyr/llext/elf.h>

◆ R_ARM_LDR_PC_G2

#define R_ARM_LDR_PC_G2   63

#include <zephyr/llext/elf.h>

◆ R_ARM_MOVT_ABS

#define R_ARM_MOVT_ABS   44

#include <zephyr/llext/elf.h>

◆ R_ARM_MOVT_PREL

#define R_ARM_MOVT_PREL   46

#include <zephyr/llext/elf.h>

◆ R_ARM_MOVW_ABS_NC

#define R_ARM_MOVW_ABS_NC   43

#include <zephyr/llext/elf.h>

◆ R_ARM_MOVW_PREL_NC

#define R_ARM_MOVW_PREL_NC   45

#include <zephyr/llext/elf.h>

◆ R_ARM_NONE

#define R_ARM_NONE   0

#include <zephyr/llext/elf.h>

◆ R_ARM_PC24

#define R_ARM_PC24   1

#include <zephyr/llext/elf.h>

◆ R_ARM_PREL31

#define R_ARM_PREL31   42

#include <zephyr/llext/elf.h>

◆ R_ARM_REL32

#define R_ARM_REL32   3

#include <zephyr/llext/elf.h>

◆ R_ARM_RELATIVE

#define R_ARM_RELATIVE   23

#include <zephyr/llext/elf.h>

◆ R_ARM_TARGET1

#define R_ARM_TARGET1   38

#include <zephyr/llext/elf.h>

◆ R_ARM_THM_CALL

#define R_ARM_THM_CALL   10

#include <zephyr/llext/elf.h>

◆ R_ARM_THM_JUMP24

#define R_ARM_THM_JUMP24   30

#include <zephyr/llext/elf.h>

◆ R_ARM_THM_MOVT_ABS

#define R_ARM_THM_MOVT_ABS   48

#include <zephyr/llext/elf.h>

◆ R_ARM_THM_MOVT_PREL

#define R_ARM_THM_MOVT_PREL   50

#include <zephyr/llext/elf.h>

◆ R_ARM_THM_MOVW_ABS_NC

#define R_ARM_THM_MOVW_ABS_NC   47

#include <zephyr/llext/elf.h>

◆ R_ARM_THM_MOVW_PREL_NC

#define R_ARM_THM_MOVW_PREL_NC   49

#include <zephyr/llext/elf.h>

◆ R_ARM_V4BX

#define R_ARM_V4BX   40

#include <zephyr/llext/elf.h>

◆ R_XTENSA_32

#define R_XTENSA_32   1

#include <zephyr/llext/elf.h>

◆ R_XTENSA_NONE

#define R_XTENSA_NONE   0

#include <zephyr/llext/elf.h>

◆ R_XTENSA_SLOT0_OP

#define R_XTENSA_SLOT0_OP   20

#include <zephyr/llext/elf.h>

◆ SHF_ALLOC

#define SHF_ALLOC   0x2

#include <zephyr/llext/elf.h>

◆ SHF_EXECINSTR

#define SHF_EXECINSTR   0x4

#include <zephyr/llext/elf.h>

◆ SHF_WRITE

#define SHF_WRITE   0x1

#include <zephyr/llext/elf.h>

◆ SHN_ABS

#define SHN_ABS   0xfff1

#include <zephyr/llext/elf.h>

◆ SHN_COMMON

#define SHN_COMMON   0xfff2

#include <zephyr/llext/elf.h>

◆ SHN_UNDEF

#define SHN_UNDEF   0

#include <zephyr/llext/elf.h>

◆ SHT_DYNSYM

#define SHT_DYNSYM   0xB

#include <zephyr/llext/elf.h>

◆ SHT_NOBITS

#define SHT_NOBITS   0x8

#include <zephyr/llext/elf.h>

◆ SHT_PROGBITS

#define SHT_PROGBITS   0x1

#include <zephyr/llext/elf.h>

◆ SHT_REL

#define SHT_REL   0x9

#include <zephyr/llext/elf.h>

◆ SHT_RELA

#define SHT_RELA   0x4

#include <zephyr/llext/elf.h>

◆ SHT_STRTAB

#define SHT_STRTAB   0x3

#include <zephyr/llext/elf.h>

◆ SHT_SYMTAB

#define SHT_SYMTAB   0x2

#include <zephyr/llext/elf.h>

◆ STB_GLOBAL

#define STB_GLOBAL   1

#include <zephyr/llext/elf.h>

◆ STB_HIOS

#define STB_HIOS   12

#include <zephyr/llext/elf.h>

◆ STB_HIPROC

#define STB_HIPROC   15

#include <zephyr/llext/elf.h>

◆ STB_LOCAL

#define STB_LOCAL   0

#include <zephyr/llext/elf.h>

◆ STB_LOOS

#define STB_LOOS   10

#include <zephyr/llext/elf.h>

◆ STB_LOPROC

#define STB_LOPROC   13

#include <zephyr/llext/elf.h>

◆ STB_WEAK

#define STB_WEAK   2

#include <zephyr/llext/elf.h>

◆ STT_COMMON

#define STT_COMMON   5

#include <zephyr/llext/elf.h>

◆ STT_FILE

#define STT_FILE   4

#include <zephyr/llext/elf.h>

◆ STT_FUNC

#define STT_FUNC   2

#include <zephyr/llext/elf.h>

◆ STT_HIOS

#define STT_HIOS   12

#include <zephyr/llext/elf.h>

◆ STT_HIPROC

#define STT_HIPROC   15

#include <zephyr/llext/elf.h>

◆ STT_LOOS

#define STT_LOOS   10

#include <zephyr/llext/elf.h>

◆ STT_LOPROC

#define STT_LOPROC   13

#include <zephyr/llext/elf.h>

◆ STT_NOTYPE

#define STT_NOTYPE   0

#include <zephyr/llext/elf.h>

◆ STT_OBJECT

#define STT_OBJECT   1

#include <zephyr/llext/elf.h>

◆ STT_SECTION

#define STT_SECTION   3

#include <zephyr/llext/elf.h>

Typedef Documentation

◆ elf32_addr

#include <zephyr/llext/elf.h>

Unsigned program address.

◆ elf32_half

#include <zephyr/llext/elf.h>

Unsigned medium integer.

◆ elf32_off

#include <zephyr/llext/elf.h>

Unsigned file offset.

◆ elf32_sword

#include <zephyr/llext/elf.h>

Signed integer.

◆ elf32_word

#include <zephyr/llext/elf.h>

Unsigned integer.

◆ elf64_addr

#include <zephyr/llext/elf.h>

Unsigned program address.

◆ elf64_half

#include <zephyr/llext/elf.h>

Unsigned medium integer.

◆ elf64_off

#include <zephyr/llext/elf.h>

Unsigned file offset.

◆ elf64_sword

#include <zephyr/llext/elf.h>

Signed integer.

◆ elf64_sxword

#include <zephyr/llext/elf.h>

Signed long integer.

◆ elf64_word

#include <zephyr/llext/elf.h>

Unsigned integer.

◆ elf64_xword

#include <zephyr/llext/elf.h>

Unsigned long integer.

◆ elf_addr

#include <zephyr/llext/elf.h>

Machine sized program address.

◆ elf_ehdr_t

typedef struct elf64_ehdr elf_ehdr_t

#include <zephyr/llext/elf.h>

Machine sized elf header structure.

◆ elf_half

#include <zephyr/llext/elf.h>

Machine sized small integer.

◆ elf_phdr_t

typedef struct elf64_phdr elf_phdr_t

#include <zephyr/llext/elf.h>

Machine sized program header structure.

◆ elf_rel_t

typedef struct elf64_rel elf_rel_t

#include <zephyr/llext/elf.h>

Machine sized relocation struct.

◆ elf_rela_t

typedef struct elf64_rela elf_rela_t

#include <zephyr/llext/elf.h>

◆ elf_shdr_t

typedef struct elf64_shdr elf_shdr_t

#include <zephyr/llext/elf.h>

Machine sized section header structure.

◆ elf_sym_t

typedef struct elf64_sym elf_sym_t

#include <zephyr/llext/elf.h>

Machine sized symbol struct.

◆ elf_word

#include <zephyr/llext/elf.h>

Machine sized integer.