Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Globals   Related Pages  

elf32.h File Reference

ELF32 file format header. More...

Go to the source code of this file.

Data Structures

struct  elf32_hdr
 32-bit ELF header. More...

struct  elf32_shdr
 ELF32 Section header. More...


Defines

#define EI_NIDENT   16
 Size of e_ident[].

#define EI_MAG0   0
 File magic number (0).

#define EI_MAG1   1
 File magic number (1).

#define EI_MAG2   2
 File magic number (2).

#define EI_MAG3   3
 File magic number (3).

#define EI_CLASS   4
 File class.

#define EI_DATA   5
 Data encoding.

#define EI_VERSION   6
 File version.

#define EI_PAD   7
 Start of padding bytes.

#define ELF_MAG0   0x7F
 < ELF magic number.

#define ELF_MAG1   'E'
 < ELF magic number[0].

#define ELF_MAG2   'L'
 ELF magic number[1].

#define ELF_MAG3   'F'
 ELF magic number[2].

#define ELF_CLASSNONE   0
 Invalid class.

#define ELF_CLASS32   1
 32-bit objects.

#define ELF_CLASS64   2
 64-bit objects.

#define ELF_DATANONE   0
 Invalid data encoding.

#define ELF_DATA2LSB   1
 Least significant byte encoding.

#define ELF_DATA2MSB   2
 Most significant byte encoding.

#define SHT_NULL   0
 The section is inactive.

#define SHT_PROGBITS   1
 The section holds informations defined by the program, whose format and meaning are determined solely by the program.

#define SHT_SYMTAB   2
 The section holds a symbol table.

#define SHT_STRTAB   3
 The section holds a string table.

#define SHT_RELA   4
 The section holds relocation entries.

#define SHT_HASH   5
 The section holds a symbol hash table.

#define SHT_DYNAMIC   6
 The section holds informations for dynamic linking.

#define SHT_NOTE   7
 The section holds informations that marks the file in some way.

#define SHT_NOBITS   8
 A section of this type occupies no space in the file but otherwise resembles SHT_PROGBITS. Although this section contains no bytes, the sh_offset member contains the conceptual file offset. For example the ".bss" section can be considered a section of this type.

#define SHT_REL   9
 The section holds a relocation entries without explicit addends.

#define SHT_SHLIB   10
 This section type is reserved, but has unspecified semantics.

#define SHT_DYNSYM   11
 This section contains a set of dynamic linking symbols.

#define SHT_LOPROC   0x700000000
 Values in this exclusive range are reserved for processor-specific semantics.

#define SHT_HIPROC   0x700000000
 Values in this exclusive range are reserved for processor-specific semantics.

#define SHT_LOUSER   0x700000000
 This value specifies the lower bound of the range of indexes reserved for application programs.

#define SHT_HIUSER   0x700000000
 This value specifies the upper bound of the range of indexes reserved for application programs.

#define SHF_WRITE   0x1
 Data should be writable during the process execution.

#define SHF_ALLOC   0x2
 The section occupies memory during the process execution.

#define SHF_EXECINSTR   0x4
 The section contains executable machine instructions.

#define SHF_MASKPROC   0xF00000000
 All bits included in this mask are reserved for processor-specific semantics.


Typedefs

typedef uint32_t Elf32_Addr
typedef uint16_t Elf32_Half
typedef uint32_t Elf32_Off
typedef int32_t Elf32_Sword
typedef uint32_t Elf32_Word
typedef elf32_hdr elf32_hdr_t
 32-bit ELF header.

typedef elf32_shdr elf32_shdr_t
 ELF32 Section header.


Functions

uint32_t elf32_copy_sections (elf32_hdr_t *f)
 Copy the ELF32 sections at the right locations in memory.
Parameters:
f  The buffer where the ELF32 file is located.
Returns:
  • the entry point address on success;
  • NULL if an error occurs.


int elf32_load_file (char *file_name, void *file_buffer)
 Load an ELF32 file into a buffer.
Parameters:
file_name  The name of the file to be loaded.
file_buffer  The buffer where the file will be loaded.
Returns:
  • 0 on success;
  • -ENOENT if the file doesn't exist;
  • -ENOEXEC if the file is not a valid ELF32 file.


int elf32_exec (void *f, int argc, char **argv)
 Execute a file.


Detailed Description

ELF32 file format header.

Author:
Andrea Righi <drizzt@inwind.it>
Date:
Last update: 2003-10-01
Note:
Copyright (©) 2003 Andrea Righi

Definition in file elf32.h.


Generated on Fri Feb 20 15:32:17 2004 for Minirighi by doxygen1.2.18