libelf/elf.h

60 lines
1.4 KiB
C
Raw Normal View History

2016-11-22 00:11:53 +03:00
typedef struct Fhdr Fhdr;
/*
* Portable ELF file header
*/
struct Fhdr {
/* ELF Data */
unsigned int (*get8)(void*, uint8_t*);
unsigned int (*get16)(void*, uint16_t*);
unsigned int (*get32)(void*, uint32_t*);
unsigned int (*get64)(void*, uint64_t*);
/* ELF Class */
int (*readelfehdr)(FILE*, Fhdr*);
int (*readelfshdr)(FILE*, Fhdr*);
int (*readelfphdr)(FILE*, Fhdr*);
int (*readelfstrndx)(FILE*, Fhdr*);
/* ELF Identification */
uint8_t class; /* File class */
uint8_t data; /* Data encoding */
uint8_t elfversion; /* File version */
uint8_t osabi; /* Operating system/ABI identification */
uint8_t abiversion; /* ABI version */
2016-11-22 00:11:53 +03:00
/* ELF Header */
uint16_t type;
uint16_t machine;
uint32_t version;
uint64_t entry;
2016-11-22 00:11:53 +03:00
uint64_t phoff;
uint64_t shoff;
uint16_t ehsize; /* ELF Header size */
uint16_t phentsize; /* Section Header size */
uint16_t phnum;
uint16_t shentsize; /* Program Header size */
uint16_t shnum;
uint16_t shstrndx;
/* Section Header */
uint32_t name;
uint64_t offset;
uint64_t size;
/* String Table */
uint32_t strndxsize; /* String Table size */
uint8_t *strndx; /* Copy of String Table */
};
int readelf(FILE*, Fhdr*);
uint8_t* readelfsection(FILE*, char*, uint64_t*, Fhdr*);
void freeelf(Fhdr*);
2017-07-28 00:38:26 +03:00
void printelfhdr(Fhdr*);
2017-07-28 00:36:16 +03:00
char* elfclass(uint8_t);
2017-07-28 00:36:34 +03:00
char* elfdata(uint8_t);
2017-07-28 00:36:55 +03:00
char* elfosabi(uint8_t);
2017-07-28 00:32:52 +03:00
char* elftype(uint16_t);
2017-07-28 00:34:50 +03:00
char* elfmachine(uint16_t);
2017-07-28 00:35:57 +03:00
char* elfversion(uint8_t);