edv:prg:c:elf
Inhaltsverzeichnis
Executable and Linking Format (ELF)
Executable and Linking Format (ELF): https://de.wikipedia.org/wiki/Executable_and_Linking_Format (außerdem: a.out, COFF, COM, ECOFF, ELF, Hunk, Mach-O, MZ, NE, OMF, PE, PEF, XCOFF)
Das ELF-Binärformat: http://www.linux-kernel.de/appendix/ap05.pdf - Doku: Aufbau und Struktur, ELF-Header.
ELF Header: http://www.sco.com/developers/gabi/latest/ch4.eheader.html - mit ausführlicher Beschreibung von e_type, e_machine, EI_OSABI, etc.
Linux Programmer's Manual:
- elf(5) - Header <elf.h>
- readelf(1) - Displays information about ELF files.
Datentypen
<elf.h>
/* 32-bit ELF base types. */ typedef uint16_t Elf32_Half; typedef uint32_t Elf32_Word; typedef int32_t Elf32_Sword; typedef uint64_t Elf32_Xword; typedef int64_t Elf32_Sxword; typedef uint32_t Elf32_Addr; typedef uint32_t Elf32_Off; typedef uint16_t Elf32_Section; typedef Elf32_Half Elf32_Versym; /* 64-bit ELF base types. */ typedef uint16_t Elf64_Half; typedef uint32_t Elf64_Word; typedef int32_t Elf64_Sword; typedef uint64_t Elf64_Xword; typedef int64_t Elf64_Sxword; typedef uint64_t Elf64_Addr; typedef uint64_t Elf64_Off; typedef uint16_t Elf64_Section; typedef Elf64_Half Elf64_Versym;
ELF-Header
(aus <elf.h>)
Auf 32-Bit-Architekturen:
#define EI_NIDENT 16 typedef struct elf32_hdr { unsigned char e_ident[EI_NIDENT]; Elf32_Half e_type; Elf32_Half e_machine; Elf32_Word e_version; Elf32_Addr e_entry; /* Entry point */ Elf32_Off e_phoff; Elf32_Off e_shoff; Elf32_Word e_flags; Elf32_Half e_ehsize; Elf32_Half e_phentsize; Elf32_Half e_phnum; Elf32_Half e_shentsize; Elf32_Half e_shnum; Elf32_Half e_shstrndx; } Elf32_Ehdr;
Auf 64-Bit-Architekturen:
#define EI_NIDENT 16 typedef struct elf64_hdr { unsigned char e_ident[EI_NIDENT]; /* ELF magic number */ Elf64_Half e_type; Elf64_Half e_machine; Elf64_Word e_version; Elf64_Addr e_entry; /* Entry point virtual address */ Elf64_Off e_phoff; /* Program header table file offset */ Elf64_Off e_shoff; /* Section header table file offset */ Elf64_Word e_flags; Elf64_Half e_ehsize; Elf64_Half e_phentsize; Elf64_Half e_phnum; Elf64_Half e_shentsize; Elf64_Half e_shnum; Elf64_Half e_shstrndx; } Elf64_Ehdr;
Weitere Infos
Redirecting functions in shared ELF libraries: http://www.codeproject.com/Articles/70302/Redirecting-functions-in-shared-ELF-libraries
Stand: 12.09.2016
— : Jürgen Kreick
EOF
edv/prg/c/elf.txt · Zuletzt geändert: 2020/01/11 01:23 von 127.0.0.1