KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
ELF File Format

API for loading and managing ELF files. More...

Modules

 Architecture Types
 Relevant ELF architecture type codes.
 
 Relocation Types
 ELF relocation type values.
 
 Section Header Flags
 ELF section header flags.
 
 Section Header Types
 ELF section header type values.
 
 Special Section Indices
 ELF section indices.
 
 Symbol Binding Types
 ELF symbol binding type values.
 
 Symbol Types
 ELF symbol type values.
 

Files

file  elf.h
 ELF binary loading support.
 

Data Structures

struct  elf_hdr_t
 ELF file header. More...
 
struct  elf_shdr_t
 ELF Section header. More...
 
struct  elf_sym_t
 Symbol table entry. More...
 
struct  elf_rela_t
 ELF Relocation entry (with explicit addend). More...
 
struct  elf_rel_t
 ELF Relocation entry (without explicit addend). More...
 
struct  elf_prog_t
 Kernel-specific definition of a loaded ELF binary. More...
 

Macros

#define ELF32_ST_BIND(info)   ((info) >> 4)
 Retrieve the binding type for a symbol.
 
#define ELF32_ST_TYPE(info)   ((info) & 0xf)
 Retrieve the symbol type for a symbol.
 
#define ELF32_R_SYM(i)   ((i) >> 8)
 Retrieve the symbol index from a relocation entry.
 
#define ELF32_R_TYPE(i)   ((uint8)(i))
 Retrieve the relocation type from a relocation entry.
 

Functions

int elf_load (const char *fn, struct klibrary *shell, elf_prog_t *out)
 Load an ELF binary.
 
void elf_free (elf_prog_t *prog)
 Free a loaded ELF program.
 

Detailed Description

API for loading and managing ELF files.

Macro Definition Documentation

◆ ELF32_R_SYM

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

Retrieve the symbol index from a relocation entry.

Parameters
iThe info field of an elf_rel_t or elf_rela_t.
Returns
The symbol table index from that relocation entry.

◆ ELF32_R_TYPE

#define ELF32_R_TYPE (   i)    ((uint8)(i))

Retrieve the relocation type from a relocation entry.

Parameters
iThe info field of an elf_rel_t or an elf_rela_t.
Returns
The relocation type of that relocation.
See also
Relocation Types

◆ ELF32_ST_BIND

#define ELF32_ST_BIND (   info)    ((info) >> 4)

Retrieve the binding type for a symbol.

Parameters
infoThe info field of an elf_sym_t.
Returns
The binding type of the symbol.
See also
Symbol Binding Types

◆ ELF32_ST_TYPE

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

Retrieve the symbol type for a symbol.

Parameters
infoThe info field of an elf_sym_t.
Returns
The symbol type of the symbol.
See also
Symbol Types

Function Documentation

◆ elf_free()

void elf_free ( elf_prog_t prog)

Free a loaded ELF program.

This function cleans up an ELF binary that was loaded with elf_load().

Parameters
progThe loaded binary to clean up.

◆ elf_load()

int elf_load ( const char *  fn,
struct klibrary *  shell,
elf_prog_t out 
)

Load an ELF binary.

This function loads an ELF binary from the VFS and fills in an elf_prog_t for it.

Parameters
fnThe filename of the binary on the VFS.
shellUnused?
outStorage for the binary that will be loaded.
Returns
0 on success, <0 on failure.