23 #include <sys/cdefs.h>
27 #include <sys/queue.h>
72 #define SHT_PROGBITS 1
84 #define SHT_LOPROC 0x70000000
85 #define SHT_HIPROC 0x7fffffff
86 #define SHT_LOUSER 0x80000000
87 #define SHT_HIUSER 0xffffffff
99 #define SHF_EXECINSTR 4
100 #define SHF_MASKPROC 0xf0000000
110 #define SHN_ABS 0xfff1
176 #define STT_SECTION 3
200 #define ELF32_ST_BIND(info) ((info) >> 4)
207 #define ELF32_ST_TYPE(info) ((info) & 0xf)
252 #define ELF32_R_SYM(i) ((i) >> 8)
259 #define ELF32_R_TYPE(i) ((uint8)(i))
uint32 flags
Processor flags.
Definition: elf.h:44
uint16 machine
ELF file architecture.
Definition: elf.h:39
uint16 type
ELF file type.
Definition: elf.h:38
ptr_t lib_get_version
Pointer to get_version() function.
Definition: elf.h:277
uint32 link
Section header table index link.
Definition: elf.h:127
uint32 size
Size (if SHT_NOBITS, amount of 0s needed)
Definition: elf.h:126
ELF Section header.
Definition: elf.h:120
uint16 shstrndx
String table section index.
Definition: elf.h:50
ELF Relocation entry (without explicit addend).
Definition: elf.h:232
uint32 version
Object file version.
Definition: elf.h:40
uint16 phnum
Program header entry count.
Definition: elf.h:47
uint8 info
Symbol type and binding.
Definition: elf.h:191
uint32 offset
Offset within section.
Definition: elf.h:219
Loaded library structure.
Definition: library.h:63
uint16 shnum
Section header entry count.
Definition: elf.h:49
uint32 info
Symbol and type.
Definition: elf.h:234
uint32 entry
Entry point.
Definition: elf.h:41
long int32
32-bit signed integer
Definition: types.h:32
ptr_t lib_open
Pointer to library's open function.
Definition: elf.h:278
uint16 phentsize
Program header entry size.
Definition: elf.h:46
uint32 entsize
Fixed-size table entry sizes.
Definition: elf.h:130
ptr_t lib_close
Pointer to library's close function.
Definition: elf.h:279
uint32 type
Section type.
Definition: elf.h:122
uint32 info
Symbol and type.
Definition: elf.h:220
uint32 size
Size of the symbol.
Definition: elf.h:190
unsigned short uint16
16-bit unsigned integer
Definition: types.h:29
uint32 info
Section header extra info.
Definition: elf.h:128
uint32 name
Index into file's string table.
Definition: elf.h:188
uint32 ptr_t
Pointer arithmetic type.
Definition: types.h:47
char fn[256]
Filename of library.
Definition: elf.h:281
uint8 ident[16]
ELF identifier.
Definition: elf.h:37
uint16 ehsize
ELF header size in bytes.
Definition: elf.h:45
uint32 offset
Offset within section.
Definition: elf.h:233
unsigned long uint32
32-bit unsigned integer
Definition: types.h:28
Kernel-specific definition of a loaded ELF binary.
Definition: elf.h:271
uint32 addr
In-memory offset.
Definition: elf.h:124
void * data
Pointer to program in memory.
Definition: elf.h:272
uint32 addralign
Alignment constraints.
Definition: elf.h:129
uint32 shoff
Section header offset.
Definition: elf.h:43
Symbol table entry.
Definition: elf.h:187
ELF file header.
Definition: elf.h:36
uint32 phoff
Program header offset.
Definition: elf.h:42
void elf_free(elf_prog_t *prog)
Free a loaded ELF program.
uint32 flags
Section flags.
Definition: elf.h:123
uint16 shentsize
Section header entry size.
Definition: elf.h:48
unsigned char uint8
8-bit unsigned integer
Definition: types.h:30
int32 addend
Constant addend for the symbol.
Definition: elf.h:221
uint32 offset
On-disk offset.
Definition: elf.h:125
uint16 shndx
Section index.
Definition: elf.h:193
ELF Relocation entry (with explicit addend).
Definition: elf.h:218
uint8 other
0. Holds no meaning.
Definition: elf.h:192
uint32 size
Memory image size (rounded up to page size)
Definition: elf.h:273
ptr_t lib_get_name
Pointer to get_name() function.
Definition: elf.h:276
int elf_load(const char *fn, struct klibrary *shell, elf_prog_t *out)
Load an ELF binary.
uint32 value
Value of the symbol.
Definition: elf.h:189
uint32 name
Index into string table.
Definition: elf.h:121
struct elf_prog elf_prog_t
Kernel-specific definition of a loaded ELF binary.