2006-06-12 17:22:12 +02:00
|
|
|
#define ELF_MAGIC 0x464C457FU /* "\x7FELF" in little endian */
|
|
|
|
|
|
|
|
struct Elf {
|
2006-07-16 17:41:47 +02:00
|
|
|
uint32_t magic; // must equal ELF_MAGIC
|
|
|
|
uint8_t elf[12];
|
|
|
|
uint16_t type;
|
|
|
|
uint16_t machine;
|
|
|
|
uint32_t version;
|
|
|
|
uint32_t entry;
|
|
|
|
uint32_t phoff;
|
|
|
|
uint32_t shoff;
|
|
|
|
uint32_t flags;
|
|
|
|
uint16_t ehsize;
|
|
|
|
uint16_t phentsize;
|
|
|
|
uint16_t phnum;
|
|
|
|
uint16_t shentsize;
|
|
|
|
uint16_t shnum;
|
|
|
|
uint16_t shstrndx;
|
2006-06-12 17:22:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Proghdr {
|
2006-07-16 17:41:47 +02:00
|
|
|
uint32_t type;
|
|
|
|
uint32_t offset;
|
|
|
|
uint32_t va;
|
|
|
|
uint32_t pa;
|
|
|
|
uint32_t filesz;
|
|
|
|
uint32_t memsz;
|
|
|
|
uint32_t flags;
|
|
|
|
uint32_t align;
|
2006-06-12 17:22:12 +02:00
|
|
|
};
|
|
|
|
|
2006-07-16 17:41:47 +02:00
|
|
|
// Values for Proghdr type
|
2006-06-12 17:22:12 +02:00
|
|
|
#define ELF_PROG_LOAD 1
|
|
|
|
|
2006-07-16 17:41:47 +02:00
|
|
|
// Flag bits for Proghdr flags
|
2006-06-12 17:22:12 +02:00
|
|
|
#define ELF_PROG_FLAG_EXEC 1
|
|
|
|
#define ELF_PROG_FLAG_WRITE 2
|
|
|
|
#define ELF_PROG_FLAG_READ 4
|
|
|
|
|