blob: 1aaf116622a54c983038ec6631d7b15b80b7c6b9 (
plain) (
tree)
|
|
#ifndef _JOVE_x86_64_ELF_H
#define _JOVE_x86_64_ELF_H 1
#include <stdint.h>
#define EI_MAG0 0x7F
#define EI_MAG1 'E'
#define EI_MAG2 'L'
#define EI_MAG3 'F'
#define EI_CLASS_32 1
#define EI_CLASS_64 2
#define EI_DATA_LE 1
#define EI_DATA_BE 2
#define EI_VERSION_CURRENT 1
#define ET_NONE 0
#define ET_REL 1
#define ET_EXEC 2
#define ET_DYN 3
typedef struct elf64_file_header
{
union {
struct {
uint8_t ei_mag[4];
uint8_t ei_class;
uint8_t ei_data;
uint8_t ei_version;
uint8_t ei_osabi;
uint8_t ei_abiver;
uint8_t ei_pad[7];
};
uint8_t e_ident[16];
};
uint16_t e_type;
uint16_t e_machine;
uint32_t e_version;
uint64_t e_entry;
uint64_t e_phoff;
uint64_t e_shoff;
uint32_t e_flags;
uint16_t e_ehsize;
uint16_t e_phentsize;
uint16_t e_phnum;
uint16_t e_shentsize;
uint16_t e_shnum;
uint16_t e_shstrndx;
} elf_header_t;
#define PT_NULL 0
#define PT_LOAD 1
#define PT_DYNAMIC 2
#define PT_INTERP 3
#define PT_NOTE 4
#define PT_SHLIB 5
#define PT_PHDR 6
#define PT_TLS 7
#define PF_X 1
#define PF_W 2
#define PF_R 4
typedef struct elf64_program_header
{
uint32_t p_type;
uint32_t p_flags;
uint64_t p_offset;
uint64_t p_vaddr;
uint64_t p_paddr;
uint64_t p_filesz;
uint64_t p_memsz;
uint64_t p_align;
} elf_phdr_t;
#define SHT_NULL 0
#define SHT_PROGBITS 1
typedef struct elf64_section_header
{
uint32_t sh_name;
uint32_t sh_type;
uint64_t sh_flags;
uint64_t sh_addr;
uint64_t sh_offset;
uint64_t sh_size;
uint64_t sh_addralign;
uint64_t sh_entsize;
} elf_shdr_t;
#endif
|