FreeNOS
Data Structures | Typedefs
libexec

Executable formats library can parse and extract program code and data. More...

Data Structures

class  ELF
 Executable and Linkable Format (ELF). More...
 
struct  ELFHeader
 Describes an ELF executable and must be placed at the beginning of executable programs. More...
 
struct  ELFSegment
 ELF program segment in the executable file. More...
 
class  ExecutableFormat
 Abstraction class of various executable formats. More...
 
class  Lz4Decompressor
 Decompress data using the LZ4 algorithm created by Yann Collet. More...
 

Typedefs

typedef struct ELFHeader ELFHeader
 Describes an ELF executable and must be placed at the beginning of executable programs. More...
 
typedef struct ELFSegment ELFSegment
 ELF program segment in the executable file. More...
 
typedef Address EntryPoint
 Entry point of a program. More...
 
typedef ExecutableFormatFormatDetector(u8 *image, Size size)
 Confirms if we understand the given format. More...
 

Identification indexes

#define ELF_INDEX_MAGIC0   0
 Magic number byte 0 index. More...
 
#define ELF_INDEX_MAGIC1   1
 Magic number byte 1 index. More...
 
#define ELF_INDEX_MAGIC2   2
 Magic number byte 2 index. More...
 
#define ELF_INDEX_MAGIC3   3
 Magic number byte 3 index. More...
 
#define ELF_INDEX_CLASS   4
 File class index. More...
 
#define ELF_INDEX_DATA   5
 Data encoding index. More...
 
#define ELF_INDEX_VERSION   6
 File version index. More...
 
#define ELF_INDEX_PAD   7
 Unused padding index. More...
 
#define ELF_INDEX_NIDENT   16
 Number of bytes in the ELF identity field. More...
 

Magic numbers

#define ELF_MAGIC0   0x7f
 Magic number byte 0. More...
 
#define ELF_MAGIC1   'E'
 Magic number byte 1. More...
 
#define ELF_MAGIC2   'L'
 Magic number byte 2. More...
 
#define ELF_MAGIC3   'F'
 Magic number byte 3. More...
 

Processor classes

#define ELF_CLASS_NONE   0
 Invalid class. More...
 
#define ELF_CLASS_32   1
 32-bit objects. More...
 
#define ELF_CLASS_64   2
 64-bit objects. More...
 

Data encoding (endianness)

#define ELF_DATA_NONE   0
 Invalid data encoding. More...
 
#define ELF_DATA_2LSB   1
 2-complement, little endian. More...
 
#define ELF_DATA_2MSB   2
 2-complement, big endian. More...
 

Object file types

#define ELF_TYPE_NONE   0
 No file type. More...
 
#define ELF_TYPE_REL   1
 Relocatable file. More...
 
#define ELF_TYPE_EXEC   2
 Executable file. More...
 
#define ELF_TYPE_DYN   3
 Shared object file. More...
 
#define ELF_TYPE_CORE   4
 Core file. More...
 
#define ELF_TYPE_NUM   5
 Number of defined types. More...
 
#define ELF_TYPE_LOPROC   0xff00
 Processor-specific range start. More...
 
#define ELF_TYPE_HIPROC   0xffff
 Processor-specific range end. More...
 

Machine architectures

#define ELF_MACHINE_NONE   0
 No machine. More...
 
#define ELF_MACHINE_M32   1
 AT&T WE 32100. More...
 
#define ELF_MACHINE_SPARC   2
 SPARC. More...
 
#define ELF_MACHINE_386   3
 Intel IBM-PC architecture. More...
 
#define ELF_MACHINE_68K   4
 Motorola 68000. More...
 
#define ELF_MACHINE_88K   5
 Motorola 88000. More...
 
#define ELF_MACHINE_860   7
 Intel 80860. More...
 
#define ELF_MACHINE_MIPS_RS3   8
 MIPS RS3000 big endian. More...
 
#define ELF_MACHINE_MIPS_RS4   10
 MIPS RS4000 big endian. More...
 

Object file version.

#define ELF_VERSION_NONE   0
 Invalid version. More...
 
#define ELF_VERSION_CURRENT   1
 Current version. More...
 

Segment types

#define ELF_SEGMENT_NULL   0
 Unused segment. More...
 
#define ELF_SEGMENT_LOAD   1
 Loadable segment. More...
 
#define ELF_SEGMENT_DYNAMIC   2
 Dynamic linker information. More...
 
#define ELF_SEGMENT_INTERP   3
 Path to an interpreter for dynamic linking. More...
 
#define ELF_SEGMENT_NOTE   4
 Auxiliary information. More...
 
#define ELF_SEGMENT_SHLIB   5
 Reserved. More...
 
#define ELF_SEGMENT_SELF   6
 Refers to the program segment header itself. More...
 
#define ELF_SEGMENT_LOPROC   0x70000000
 Reserved for processor-specific semantics. More...
 
#define ELF_SEGMENT_HIPROC   0x7fffffff
 Reserved for processor-specific semantics. More...
 

Detailed Description

Executable formats library can parse and extract program code and data.

Macro Definition Documentation

◆ ELF_CLASS_32

#define ELF_CLASS_32   1

32-bit objects.

Definition at line 97 of file ELFHeader.h.

◆ ELF_CLASS_64

#define ELF_CLASS_64   2

64-bit objects.

Definition at line 100 of file ELFHeader.h.

◆ ELF_CLASS_NONE

#define ELF_CLASS_NONE   0

Invalid class.

Definition at line 94 of file ELFHeader.h.

◆ ELF_DATA_2LSB

#define ELF_DATA_2LSB   1

2-complement, little endian.

Definition at line 115 of file ELFHeader.h.

◆ ELF_DATA_2MSB

#define ELF_DATA_2MSB   2

2-complement, big endian.

Definition at line 118 of file ELFHeader.h.

◆ ELF_DATA_NONE

#define ELF_DATA_NONE   0

Invalid data encoding.

Definition at line 112 of file ELFHeader.h.

◆ ELF_INDEX_CLASS

#define ELF_INDEX_CLASS   4

File class index.

Definition at line 49 of file ELFHeader.h.

◆ ELF_INDEX_DATA

#define ELF_INDEX_DATA   5

Data encoding index.

Definition at line 52 of file ELFHeader.h.

◆ ELF_INDEX_MAGIC0

#define ELF_INDEX_MAGIC0   0

Magic number byte 0 index.

Definition at line 37 of file ELFHeader.h.

◆ ELF_INDEX_MAGIC1

#define ELF_INDEX_MAGIC1   1

Magic number byte 1 index.

Definition at line 40 of file ELFHeader.h.

◆ ELF_INDEX_MAGIC2

#define ELF_INDEX_MAGIC2   2

Magic number byte 2 index.

Definition at line 43 of file ELFHeader.h.

◆ ELF_INDEX_MAGIC3

#define ELF_INDEX_MAGIC3   3

Magic number byte 3 index.

Definition at line 46 of file ELFHeader.h.

◆ ELF_INDEX_NIDENT

#define ELF_INDEX_NIDENT   16

Number of bytes in the ELF identity field.

Definition at line 61 of file ELFHeader.h.

◆ ELF_INDEX_PAD

#define ELF_INDEX_PAD   7

Unused padding index.

Definition at line 58 of file ELFHeader.h.

◆ ELF_INDEX_VERSION

#define ELF_INDEX_VERSION   6

File version index.

Definition at line 55 of file ELFHeader.h.

◆ ELF_MACHINE_386

#define ELF_MACHINE_386   3

Intel IBM-PC architecture.

Definition at line 172 of file ELFHeader.h.

◆ ELF_MACHINE_68K

#define ELF_MACHINE_68K   4

Motorola 68000.

Definition at line 175 of file ELFHeader.h.

◆ ELF_MACHINE_860

#define ELF_MACHINE_860   7

Intel 80860.

Definition at line 181 of file ELFHeader.h.

◆ ELF_MACHINE_88K

#define ELF_MACHINE_88K   5

Motorola 88000.

Definition at line 178 of file ELFHeader.h.

◆ ELF_MACHINE_M32

#define ELF_MACHINE_M32   1

AT&T WE 32100.

Definition at line 166 of file ELFHeader.h.

◆ ELF_MACHINE_MIPS_RS3

#define ELF_MACHINE_MIPS_RS3   8

MIPS RS3000 big endian.

Definition at line 184 of file ELFHeader.h.

◆ ELF_MACHINE_MIPS_RS4

#define ELF_MACHINE_MIPS_RS4   10

MIPS RS4000 big endian.

Definition at line 187 of file ELFHeader.h.

◆ ELF_MACHINE_NONE

#define ELF_MACHINE_NONE   0

No machine.

Definition at line 163 of file ELFHeader.h.

◆ ELF_MACHINE_SPARC

#define ELF_MACHINE_SPARC   2

SPARC.

Definition at line 169 of file ELFHeader.h.

◆ ELF_MAGIC0

#define ELF_MAGIC0   0x7f

Magic number byte 0.

Definition at line 73 of file ELFHeader.h.

◆ ELF_MAGIC1

#define ELF_MAGIC1   'E'

Magic number byte 1.

Definition at line 76 of file ELFHeader.h.

◆ ELF_MAGIC2

#define ELF_MAGIC2   'L'

Magic number byte 2.

Definition at line 79 of file ELFHeader.h.

◆ ELF_MAGIC3

#define ELF_MAGIC3   'F'

Magic number byte 3.

Definition at line 82 of file ELFHeader.h.

◆ ELF_SEGMENT_DYNAMIC

#define ELF_SEGMENT_DYNAMIC   2

Dynamic linker information.

Definition at line 269 of file ELFHeader.h.

◆ ELF_SEGMENT_HIPROC

#define ELF_SEGMENT_HIPROC   0x7fffffff

Reserved for processor-specific semantics.

Definition at line 287 of file ELFHeader.h.

◆ ELF_SEGMENT_INTERP

#define ELF_SEGMENT_INTERP   3

Path to an interpreter for dynamic linking.

Definition at line 272 of file ELFHeader.h.

◆ ELF_SEGMENT_LOAD

#define ELF_SEGMENT_LOAD   1

Loadable segment.

Definition at line 266 of file ELFHeader.h.

◆ ELF_SEGMENT_LOPROC

#define ELF_SEGMENT_LOPROC   0x70000000

Reserved for processor-specific semantics.

Definition at line 284 of file ELFHeader.h.

◆ ELF_SEGMENT_NOTE

#define ELF_SEGMENT_NOTE   4

Auxiliary information.

Definition at line 275 of file ELFHeader.h.

◆ ELF_SEGMENT_NULL

#define ELF_SEGMENT_NULL   0

Unused segment.

Definition at line 263 of file ELFHeader.h.

◆ ELF_SEGMENT_SELF

#define ELF_SEGMENT_SELF   6

Refers to the program segment header itself.

Definition at line 281 of file ELFHeader.h.

◆ ELF_SEGMENT_SHLIB

#define ELF_SEGMENT_SHLIB   5

Reserved.

Definition at line 278 of file ELFHeader.h.

◆ ELF_TYPE_CORE

#define ELF_TYPE_CORE   4

Core file.

Definition at line 142 of file ELFHeader.h.

◆ ELF_TYPE_DYN

#define ELF_TYPE_DYN   3

Shared object file.

Definition at line 139 of file ELFHeader.h.

◆ ELF_TYPE_EXEC

#define ELF_TYPE_EXEC   2

Executable file.

Definition at line 136 of file ELFHeader.h.

◆ ELF_TYPE_HIPROC

#define ELF_TYPE_HIPROC   0xffff

Processor-specific range end.

Definition at line 151 of file ELFHeader.h.

◆ ELF_TYPE_LOPROC

#define ELF_TYPE_LOPROC   0xff00

Processor-specific range start.

Definition at line 148 of file ELFHeader.h.

◆ ELF_TYPE_NONE

#define ELF_TYPE_NONE   0

No file type.

Definition at line 130 of file ELFHeader.h.

◆ ELF_TYPE_NUM

#define ELF_TYPE_NUM   5

Number of defined types.

Definition at line 145 of file ELFHeader.h.

◆ ELF_TYPE_REL

#define ELF_TYPE_REL   1

Relocatable file.

Definition at line 133 of file ELFHeader.h.

◆ ELF_VERSION_CURRENT

#define ELF_VERSION_CURRENT   1

Current version.

Definition at line 202 of file ELFHeader.h.

◆ ELF_VERSION_NONE

#define ELF_VERSION_NONE   0

Invalid version.

Definition at line 199 of file ELFHeader.h.

Typedef Documentation

◆ ELFHeader

typedef struct ELFHeader ELFHeader

Describes an ELF executable and must be placed at the beginning of executable programs.

◆ ELFSegment

typedef struct ELFSegment ELFSegment

ELF program segment in the executable file.

◆ EntryPoint

Entry point of a program.

Definition at line 34 of file ExecutableFormat.h.

◆ FormatDetector

typedef ExecutableFormat* FormatDetector(u8 *image, Size size)

Confirms if we understand the given format.

Returns
true on success and false on failure.

Definition at line 43 of file ExecutableFormat.h.