Loading...
Searching...
No Matches
elf.h File Reference
Utility Functions » ELF binary format

ELF definition. More...

`#include <l4/sys/l4int.h>`
Include dependency graph for elf.h:

Go to the source code of this file.

## Data Structures

struct | Elf32_Ehdr
| ELF32 header. More...
struct | Elf64_Ehdr
| ELF64 header. More...
struct | Elf32_Shdr
| ELF32 section header. More...
struct | Elf64_Shdr
| ELF64 section header. More...
struct | Elf32_Phdr
| ELF32 program header. More...
struct | Elf64_Phdr
| ELF64 program header. More...
struct | Elf32_Dyn
| ELF32 dynamic entry. More...
struct | Elf64_Dyn
| ELF64 dynamic entry. More...
struct | Elf32_Rel
| ELF32 relocation entry w/o addend. More...
struct | Elf32_Rela
| ELF32 relocation entry w/ addend. More...
struct | Elf64_Rel
| ELF64 relocation entry w/o addend. More...
struct | Elf64_Rela
| ELF64 relocation entry w/ addend. More...
struct | Elf32_Sym
| ELF32 symbol table entry. More...
struct | Elf64_Sym
| ELF64 symbol table entry. More...
struct | Elf32_Auxv
| Auxiliary vector (32-bit). More...
struct | Elf64_Auxv
| Auxiliary vector (64-bit). More...

## Macros

#define | ElfW(type)
| Use 64 or 32 bits types depending on the target architecture.
#define | ELF32_R_SYM(i)
| Symbol table index.
#define | ELF32_R_TYPE(i)
#define | ELF32_R_INFO(s, t)
| Create info from symbol table index + type.
#define | ELF64_R_SYM(i)
| Symbol table index.
#define | ELF64_R_TYPE(i)
#define | ELF64_R_INFO(s, t)
| Create info from symbol table index + type.
#define | ELF32_ST_BIND(i)
#define | ELF32_ST_TYPE(i)
#define | ELF32_ST_INFO(b, t)
| Make info from bind + type.
#define | ELF64_ST_BIND(i)
#define | ELF64_ST_TYPE(i)
#define | ELF64_ST_INFO(b, t)
| Make info from bind + type.

## Typedefs

typedef struct Elf32_Auxv | Elf32_Auxv
| Auxiliary vector (32-bit).
typedef struct Elf64_Auxv | Elf64_Auxv
| Auxiliary vector (64-bit).
ELF types
typedef l4_uint32_t | Elf32_Addr
| size 4 align 4
typedef l4_uint32_t | Elf32_Off
| size 4 align 4
typedef l4_uint16_t | Elf32_Half
| size 2 align 2
typedef l4_uint32_t | Elf32_Word
| size 4 align 4
typedef l4_int32_t | Elf32_Sword
| size 4 align 4
typedef l4_uint64_t | Elf64_Addr
| size 8 align 8
typedef l4_uint64_t | Elf64_Off
| size 8 align 8
typedef l4_uint16_t | Elf64_Half
| size 2 align 2
typedef l4_uint32_t | Elf64_Word
| size 4 align 4
typedef l4_int32_t | Elf64_Sword
| size 4 align 4
typedef l4_uint64_t | Elf64_Xword
| size 8 align 8
typedef l4_int64_t | Elf64_Sxword
| size 8 align 8

## Enumerations

enum | { EI_NIDENT = 16 }
enum | Elf_ETs { ET_NONE = 0 , ET_REL = 1 , ET_EXEC = 2 , ET_DYN = 3 , ET_CORE = 4 , ET_LOPROC = 0xff00 , ET_HIPROC = 0xffff }
| Object file type. More...

enum

Elf_EMs {
EM_NONE = 0 , EM_M32 = 1 , EM_SPARC = 2 , EM_386 = 3 ,
EM_68K = 4 , EM_88K = 5 , EM_860 = 7 , EM_MIPS = 8 ,
EM_MIPS_RS4_BE = 10 , EM_SPARC64 = 11 , EM_PARISC = 15 , EM_VPP500 = 17 ,
EM_SPARC32PLUS = 18 , EM_960 = 19 , EM_PPC = 20 , EM_V800 = 36 ,
EM_FR20 = 37 , EM_RH32 = 38 , EM_RCE = 39 , EM_ARM = 40 ,
EM_ALPHA = 41 , EM_SH = 42 , EM_SPARCV9 = 43 , EM_TRICORE = 44 ,
EM_ARC = 45 , EM_H8_300 = 46 , EM_H8_300H = 47 , EM_H8S = 48 ,
EM_H8_500 = 49 , EM_IA_64 = 50 , EM_MIPS_X = 51 , EM_COLDFIRE = 52 ,
EM_68HC12 = 53 , EM_X86_64 = 62 , EM_PDSP = 63 , EM_FX66 = 66 ,
EM_ST9PLUS = 67 , EM_ST7 = 68 , EM_68HC16 = 69 , EM_68HC11 = 70 ,
EM_68HC08 = 71 , EM_68HC05 = 72 , EM_SVX = 73 , EM_ST19 = 74 ,
EM_VAX = 75 , EM_CRIS = 76 , EM_JAVELIN = 77 , EM_FIREPATH = 78 ,
EM_ZSP = 79 , EM_MMIX = 80 , EM_HUANY = 81 , EM_PRISM = 82 ,
EM_AVR = 83 , EM_FR30 = 84 , EM_D10V = 85 , EM_D30V = 86 ,
EM_V850 = 87 , EM_M32R = 88 , EM_MN10300 = 89 , EM_MN10200 = 90 ,
EM_PJ = 91 , EM_OPENRISC = 92 , EM_ARC_A5 = 93 , EM_XTENSA = 94 ,
EM_ALTERA_NIOS2 = 113 , EM_AARCH64 = 183 , EM_TILEPRO = 188 , EM_MICROBLAZE = 189 ,
EM_TILEGX = 191 , EM_RISCV = 243 , EM_NUM = 244
}

| Required architecture. More...
enum | Elf_EVs { EV_NONE = 0 , EV_CURRENT = 1 }
| Object file version. More...
enum | Elf_EIs { EI_MAG0 = 0 , EI_MAG1 = 1 , EI_MAG2 = 2 , EI_MAG3 = 3 , EI_CLASS = 4 , EI_DATA = 5 , EI_VERSION = 6 , EI_OSABI = 7 , EI_ABIVERSION = 8 , EI_PAD = 9 }
| Identification Indices. More...
enum | Elf_MAGs { ELFMAG0 = 0x7f , ELFMAG1 = 'E' , ELFMAG2 = 'L' , ELFMAG3 = 'F' }
| Magic number. More...
enum | Elf_ClASSs { ELFCLASSNONE = 0 , ELFCLASS32 = 1 , ELFCLASS64 = 2 , ELFCLASSNUM = 3 }
| File class or capacity. More...
enum | Elf_DATAs { ELFDATANONE = 0 , ELFDATA2LSB = 1 , ELFDATA2MSB = 2 , ELFDATANUM = 3 }
| Data encoding. More...
enum | Elf_OSABIs { ELFOSABI_NONE = 0 , ELFOSABI_SYSV = 0 , ELFOSABI_HPUX = 1 , ELFOSABI_NETBSD = 2 , ELFOSABI_LINUX = 3 , ELFOSABI_SOLARIS = 6 , ELFOSABI_AIX = 7 , ELFOSABI_IRIX = 8 , ELFOSABI_FREEBSD = 9 , ELFOSABI_TRU64 = 10 , ELFOSABI_MODESTO = 11 , ELFOSABI_OPENBSD = 12 , ELFOSABI_ARM = 97 , ELFOSABI_STANDALONE = 255 }
| Identify operating system and ABI to which the object is targeted. More...
enum | Elf_SHNs { SHN_UNDEF = 0 , SHN_LORESERVE = 0xff00 , SHN_LOPROC = 0xff00 , SHN_HIPROC = 0xff1f , SHN_ABS = 0xfff1 , SHN_COMMON = 0xfff2 , SHN_HIRESERVE = 0xffff }
| Special section indexes. More...

enum

Elf_SHTs {
SHT_NULL = 0 , SHT_PROGBITS = 1 , SHT_SYMTAB = 2 , SHT_STRTAB = 3 ,
SHT_RELA = 4 , SHT_HASH = 5 , SHT_DYNAMIC = 6 , SHT_NOTE = 7 ,
SHT_NOBITS = 8 , SHT_REL = 9 , SHT_SHLIB = 10 , SHT_DYNSYM = 11 ,
SHT_INIT_ARRAY = 14 , SHT_FINI_ARRAY = 15 , SHT_PREINIT_ARRAY = 16 , SHT_GROUP = 17 ,
SHT_SYMTAB_SHNDX = 18 , SHT_NUM = 19 , SHT_LOOS = 0x60000000 , SHT_HIOS = 0x6fffffff ,
SHT_LOPROC = 0x70000000 , SHT_HIPROC = 0x7fffffff , SHT_LOUSER = 0x80000000 , SHT_HIUSER = 0xffffffff
}

| Section type. More...
enum | Elf_SHFs { SHF_WRITE = 0x1 , SHF_ALLOC = 0x2 , SHF_EXECINSTR = 0x4 , SHF_MERGE = 0x10 , SHF_STRINGS = 0x20 , SHF_INFO_LINK = 0x40 , SHF_OS_NONCONFORMING = 0x100 , SHF_GROUP = 0x200 , SHF_TLS = 0x400 , SHF_MASKOS = 0x0ff00000 , SHF_MASKPROC = 0xf0000000 }
| Section attribute flags. More...

enum

Elf_PTs {
PT_NULL = 0 , PT_LOAD = 1 , PT_DYNAMIC = 2 , PT_INTERP = 3 ,
PT_NOTE = 4 , PT_SHLIB = 5 , PT_PHDR = 6 , PT_TLS = 7 ,
PT_NUM = 8 , PT_LOOS = 0x60000000 , PT_HIOS = 0x6fffffff , PT_LOPROC = 0x70000000 ,
PT_HIPROC = 0x7fffffff , PT_GNU_EH_FRAME = PT_LOOS + 0x474e550 , PT_GNU_STACK = PT_LOOS + 0x474e551 , PT_GNU_RELRO = PT_LOOS + 0x474e552 ,
PT_L4_STACK = PT_LOOS + 0x12 , PT_L4_AUX = PT_LOOS + 0x14
}

| Segment types. More...
enum | ELF_PFs { PF_X = 0x1 , PF_W = 0x2 , PF_R = 0x4 , PF_MASKOS = 0x0ff00000 , PF_MASKPROC = 0x7fffffff }
| Segment permissions. More...
enum | Elf_NTs_core { NT_PRSTATUS = 1 , NT_FPREGSET = 2 , NT_PRPSINFO = 3 , NT_PRXREG = 4 , NT_TASKSTRUCT = 4 , NT_PLATFORM = 5 , NT_AUXV = 6 , NT_GWINDOWS = 7 , NT_ASRS = 8 , NT_PSTATUS = 10 , NT_PSINFO = 13 , NT_PRCRED = 14 , NT_UTSNAME = 15 , NT_LWPSTATUS = 16 , NT_LWPSINFO = 17 , NT_PRFPXREG = 20 }
| Legal values for note segment descriptor types for core files. More...
enum | Elf_NTs_obj { NT_VERSION = 1 }
| Legal values for the note segment descriptor types for object files. More...

enum

Elf_DTs {
DT_NULL = 0 , DT_NEEDED = 1 , DT_PLTRELSZ = 2 , DT_PLTGOT = 3 ,
DT_HASH = 4 , DT_STRTAB = 5 , DT_SYMTAB = 6 , DT_RELA = 7 ,
DT_RELASZ = 8 , DT_RELAENT = 9 , DT_STRSZ = 10 , DT_SYMENT = 11 ,
DT_INIT = 12 , DT_FINI = 13 , DT_SONAME = 14 , DT_RPATH = 15 ,
DT_SYMBOLIC = 16 , DT_REL = 17 , DT_RELSZ = 18 , DT_RELENT = 19 ,
DT_PTRREL = 20 , DT_DEBUG = 21 , DT_TEXTREL = 22 , DT_JMPREL = 23 ,
DT_BIND_NOW = 24 , DT_INIT_ARRAY = 25 , DT_FINI_ARRAY = 26 , DT_INIT_ARRAYSZ = 27 ,
DT_FINI_ARRAYSZ = 28 , DT_RUNPATH = 29 , DT_FLAGS = 30 , DT_ENCODING = 32 ,
DT_PREINIT_ARRAY = 32 , DT_PREINIT_ARRAYSZ = 33 , DT_NUM = 34 , DT_LOOS = 0x6000000d ,
DT_HIOS = 0x6ffff000 , DT_LOPROC = 0x70000000 , DT_HIPROC = 0x7fffffff
}

| Dynamic Array Tags. More...
enum | Elf_DFs { DF_ORIGIN = 0x00000001 , DF_SYMBOLIC = 0x00000002 , DF_TEXTREL = 0x00000004 , DF_BIND_NOW = 0x00000008 , DF_STATIC_TLS = 0x00000010 }
| Values of Elf32_Dyn.d_un.d_val, Elf64_Dyn.d_un.d_val in the DT_FLAGS entry. More...

enum

Elf_DF_1s {
DF_1_NOW = 0x00000001 , DF_1_GLOBAL = 0x00000002 , DF_1_GROUP = 0x00000004 , DF_1_NODELETE = 0x00000008 ,
DF_1_LOADFLTR = 0x00000010 , DF_1_INITFIRST = 0x00000020 , DF_1_NOOPEN = 0x00000040 , DF_1_ORIGIN = 0x00000080 ,
DF_1_DIRECT = 0x00000100 , DF_1_TRANS = 0x00000200 , DF_1_INTERPOSE = 0x00000400 , DF_1_NODEFLIB = 0x00000800 ,
DF_1_NODUMP = 0x00001000 , DF_1_CONFALT = 0x00002000 , DF_1_ENDFILTEE = 0x00004000 , DF_1_DISPRELDNE = 0x00008000 ,
DF_1_DISPRELPND = 0x00010000
}

| State flags selectable in the Elf32_Dyn.d_un.d_val / Elf64_Dyn.d_un.d_val element of the DT_FLAGS_1 entry in the dynamic section. More...
enum | Elf_DTF_1s
| Flags for the feature selection in DT_FEATURE_1.
enum | Elf_DF_P1s { DF_P1_LAZYLOAD = 0x00000001 , DF_P1_GROUPPERM = 0x00000002 }
| Flags in the DT_POSFLAG_1 entry effecting only the next DT_* entry. More...

enum

Elf_R_386_s {
R_386_NONE = 0 , R_386_32 = 1 , R_386_PC32 = 2 , R_386_GOT32 = 3 ,
R_386_PLT32 = 4 , R_386_COPY = 5 , R_386_GLOB_DAT = 6 , R_386_JMP_SLOT = 7 ,
R_386_RELATIVE = 8 , R_386_GOTOFF = 9 , R_386_GOTPC = 10 , R_386_32PLT = 11 ,
R_386_TLS_TPOFF = 14 , R_386_TLS_IE = 15 , R_386_TLS_GOTIE = 16 , R_386_TLS_LE = 17 ,
R_386_TLS_GD = 18 , R_386_TLS_LDM = 19 , R_386_16 = 20 , R_386_PC16 = 21 ,
R_386_8 = 22 , R_386_PC8 = 23 , R_386_TLS_GD_32 = 24 , R_386_TLS_GD_PUSH = 25 ,
R_386_TLS_GD_CALL = 26 , R_386_TLS_GD_POP = 27 , R_386_TLS_LDM_32 = 28 , R_386_TLS_LDM_PUSH = 29 ,
R_386_TLS_LDM_CALL = 30 , R_386_TLS_LDM_POP = 31 , R_386_TLS_LDO_32 = 32 , R_386_TLS_IE_32 = 33 ,
R_386_TLS_LE_32 = 34 , R_386_TLS_DTPMOD32 = 35 , R_386_TLS_DTPOFF32 = 36 , R_386_TLS_TPOFF32 = 37 ,
R_386_NUM = 38
}

| Relocation types (processor specific). More...
enum | Elf_EF_ARM_s { }
| ARM specific declarations. More...
enum | Elf_STT_ARM_s
| Additional symbol types for Thumb.
enum | Elf_SHF_s_ARM { SHF_ARM_ENTRYSECT = 0x10000000 , SHF_ARM_COMDEF = 0x80000000 }
| ARM-specific values for Elf32_Shdr.sh_flags / Elf64_Shdr.sh_flags. More...
enum | Elf_ARM_SBs { PF_ARM_SB = 0x10000000 }
| ARM-specific program header flags. More...

enum

Elf_R_ARM_s {
R_ARM_NONE = 0 , R_ARM_PC24 = 1 , R_ARM_ABS32 = 2 , R_ARM_REL32 = 3 ,
R_ARM_PC13 = 4 , R_ARM_ABS16 = 5 , R_ARM_ABS12 = 6 , R_ARM_THM_ABS5 = 7 ,
R_ARM_ABS8 = 8 , R_ARM_SBREL32 = 9 , R_ARM_THM_PC22 = 10 , R_ARM_THM_PC8 = 11 ,
R_ARM_AMP_VCALL9 = 12 , R_ARM_SWI24 = 13 , R_ARM_THM_SWI8 = 14 , R_ARM_XPC25 = 15 ,
R_ARM_THM_XPC22 = 16 , R_ARM_COPY = 20 , R_ARM_GLOB_DAT = 21 , R_ARM_JUMP_SLOT = 22 ,
R_ARM_RELATIVE = 23 , R_ARM_GOTOFF = 24 , R_ARM_GOTPC = 25 , R_ARM_GOT32 = 26 ,
R_ARM_PLT32 = 27 , R_ARM_ALU_PCREL_7_0 = 32 , R_ARM_ALU_PCREL_15_8 = 33 , R_ARM_ALU_PCREL_23_15 = 34 ,
R_ARM_LDR_SBREL_11_0 = 35 , R_ARM_ALU_SBREL_19_12 = 36 , R_ARM_ALU_SBREL_27_20 = 37 , R_ARM_GNU_VTENTRY = 100 ,
R_ARM_GNU_VTINHERIT = 101 , R_ARM_THM_PC11 = 102 , R_ARM_THM_PC9 = 103 , R_ARM_RXPC25 = 249 ,
R_ARM_RSBREL32 = 250 , R_ARM_THM_RPC22 = 251 , R_ARM_RREL32 = 252 , R_ARM_RABS22 = 253 ,
R_ARM_RPC24 = 254 , R_ARM_RBASE = 255 , R_ARM_NUM = 256
}

| ARM relocations. More...
enum | Elf_R_AARCH64_s { R_AARCH64_NONE = 0 , R_AARCH64_RELATIVE = 1027 }
| AARCH64 relocations. More...

enum

Elf_R_X86_64_s {
R_X86_64_NONE = 0 , R_X86_64_64 = 1 , R_X86_64_PC32 = 2 , R_X86_64_GOT32 = 3 ,
R_X86_64_PLT32 = 4 , R_X86_64_COPY = 5 , R_X86_64_GLOB_DAT = 6 , R_X86_64_JUMP_SLOT = 7 ,
R_X86_64_RELATIVE = 8 , R_X86_64_GOTPCREL = 9 , R_X86_64_32 = 10 , R_X86_64_32S = 11 ,
R_X86_64_16 = 12 , R_X86_64_PC16 = 13 , R_X86_64_8 = 14 , R_X86_64_PC8 = 15 ,
R_X86_64_DTPMOD64 = 16 , R_X86_64_DTPOFF64 = 17 , R_X86_64_TPOFF64 = 18 , R_X86_64_TLSGD = 19 ,
R_X86_64_TLSLD = 20 , R_X86_64_DTPOFF32 = 21 , R_X86_64_GOTTPOFF = 22 , R_X86_64_TPOFF32 = 23 ,
R_X86_64_NUM = 24
}

| AMD x86-64 relocations. More...
enum | Elf_STNs
| Symbol Table Entry.
enum | Elf_STBs { STB_LOCAL = 0 , STB_GLOBAL = 1 , STB_WEAK = 2 , STB_LOOS = 10 , STB_HIOS = 12 , STB_LOPROC = 13 , STB_HIPROC = 15 }
| Symbol Binding. More...
enum | Elf_STTs { STT_NOTYPE = 0 , STT_OBJECT = 1 , STT_FUNC = 2 , STT_SECTION = 3 , STT_FILE = 4 , STT_LOOS = 10 , STT_HIOS = 12 , STT_LOPROC = 13 , STT_HIPROC = 15 }
| Symbol Types. More...
enum | Elf_ATs { AT_NULL = 0 , AT_IGNORE = 1 , AT_EXECFD = 2 , AT_PHDR = 3 , AT_PHENT = 4 , AT_PHNUM = 5 , AT_PAGESZ = 6 , AT_BASE = 7 , AT_FLAGS = 8 , AT_ENTRY = 9 , AT_NOTELF = 10 , AT_UID = 11 , AT_EUID = 12 , AT_GID = 13 , AT_EGID = 14 , AT_L4_AUX = 0xf0 , AT_L4_ENV = 0xf1 }
| Legal values for Elf32_Auxv.atype / Elf64_Auxv.atype. More...

## Detailed Description

ELF definition.

Date
  08/18/2000

Author
  Frank Mehnert fm3@o.nosp@m.s.in.nosp@m.f.tu-.nosp@m.dres.nosp@m.den.d.nosp@m.e Alexander Warg aw11@.nosp@m.os.i.nosp@m.nf.tu.nosp@m.-dre.nosp@m.sden..nosp@m.de

Many structs from "Executable and Linkable Format (ELF)", Portable Formats Specification, Version 1.1 and "System V Application Binary Interface - DRAFT - April 29, 1998" The Santa Cruz Operation, Inc. (see http://www.sco.com/developer/gabi/contents.html)

Definition in file elf.h.