58 lines
1.0 KiB
C
58 lines
1.0 KiB
C
#ifndef ELF_HEADER_H
|
|
#define ELF_HEADER_H
|
|
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <stdint.h>
|
|
#include <string.h>
|
|
|
|
typedef struct elf_header ELFHeader;
|
|
|
|
ELFHeader* ParseObjectFile(const char* bytes, size_t size);
|
|
|
|
typedef enum ELFType{
|
|
ET_None = 0, //No file type
|
|
ET_Rel = 1, //Relocatable file
|
|
ET_Exec = 2, //Executable file
|
|
ET_Dyn = 3, //Shared object file
|
|
ET_Core = 4, //Core file
|
|
ET_LOProc = 0xff00, //Processor
|
|
ET_HIProc = 0xffff //Specific
|
|
} ELFType;
|
|
|
|
typedef enum ELFMachine
|
|
{
|
|
EM_None = 0,
|
|
EM_M32 = 1, //AT&T WE 32100
|
|
EM_Sparc = 2,
|
|
EM_386 = 3,
|
|
EM_68k = 4,
|
|
EM_88k = 5,
|
|
EM_860 = 7,
|
|
EM_MIPS = 8,
|
|
EM_X86_64 = 62
|
|
} ELFMachine;
|
|
|
|
typedef enum ELFOSABI
|
|
{
|
|
ELFOSABI_SYSTEMV = 0,
|
|
ELFOSABI_HPUX = 1,
|
|
ELFOSABI_NETBSD = 2,
|
|
ELFOSABI_GNU = 3,
|
|
ELFOSABI_LINUX = 3,
|
|
ELFOSABI_SOLARIS = 6,
|
|
ELFOSABI_AIX,
|
|
ELFOSABI_IRIX,
|
|
ELFOSABI_FREEBSD,
|
|
ELFOSABI_TRU64,
|
|
ELFOSABI_MODESTO,
|
|
ELFOSABI_OPENBSD,
|
|
ELFOSABI_OPENVMS,
|
|
ELFOSABI_NSK,
|
|
ELFOSABI_AROS,
|
|
ELFOSABI_FENIXOS,
|
|
ELFOSABI_CLOUDABI,
|
|
ELFOSABI_OPENVOS
|
|
} ELFOSABI;
|
|
|
|
#endif |