export type, machine, version and entry header fields

This commit is contained in:
David du Colombier 2017-07-27 23:24:49 +02:00
parent d62e3c29b5
commit 25e679c0c2
3 changed files with 18 additions and 0 deletions

View File

@ -28,6 +28,10 @@ struct Fhdr {
... ...
/* ELF Header */ /* ELF Header */
uint16_t type;
uint16_t machine;
uint32_t version;
uint64_t entry;
uint64_t phoff; uint64_t phoff;
uint64_t shoff; uint64_t shoff;
uint16_t ehsize; /* ELF Header size */ uint16_t ehsize; /* ELF Header size */

10
elf.c
View File

@ -164,6 +164,11 @@ readelf32ehdr(FILE *f, Fhdr *fp)
return -1; return -1;
} }
fp->type = e.type;
fp->machine = e.machine;
fp->version = e.version;
fp->entry = e.entry;
fp->shoff = e.shoff; fp->shoff = e.shoff;
fp->phoff = e.phoff; fp->phoff = e.phoff;
fp->phnum = e.phnum; fp->phnum = e.phnum;
@ -229,6 +234,11 @@ readelf64ehdr(FILE *f, Fhdr *fp)
return -1; return -1;
} }
fp->type = e.type;
fp->machine = e.machine;
fp->version = e.version;
fp->entry = e.entry;
fp->shoff = e.shoff; fp->shoff = e.shoff;
fp->phoff = e.phoff; fp->phoff = e.phoff;
fp->phnum = e.phnum; fp->phnum = e.phnum;

4
elf.h
View File

@ -17,6 +17,10 @@ struct Fhdr {
int (*readelfstrndx)(FILE*, Fhdr*); int (*readelfstrndx)(FILE*, Fhdr*);
/* ELF Header */ /* ELF Header */
uint16_t type;
uint16_t machine;
uint32_t version;
uint64_t entry;
uint64_t phoff; uint64_t phoff;
uint64_t shoff; uint64_t shoff;
uint16_t ehsize; /* ELF Header size */ uint16_t ehsize; /* ELF Header size */