mirror of https://github.com/0intro/libelf
export class, data, elfversion, osabi and abiversion ident header fields
This commit is contained in:
parent
25e679c0c2
commit
d18527e32e
|
@ -27,6 +27,13 @@ struct Fhdr {
|
||||||
/* Private */
|
/* Private */
|
||||||
...
|
...
|
||||||
|
|
||||||
|
/* 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 */
|
||||||
|
|
||||||
/* ELF Header */
|
/* ELF Header */
|
||||||
uint16_t type;
|
uint16_t type;
|
||||||
uint16_t machine;
|
uint16_t machine;
|
||||||
|
|
6
elf.c
6
elf.c
|
@ -509,6 +509,12 @@ readident(FILE *f, Fhdr *fp)
|
||||||
if (i == nelem(data))
|
if (i == nelem(data))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
fp->class = buf[EI_CLASS];
|
||||||
|
fp->data = buf[EI_DATA];
|
||||||
|
fp->elfversion = buf[EI_VERSION];
|
||||||
|
fp->osabi = buf[EI_OSABI];
|
||||||
|
fp->abiversion = buf[EI_ABIVERSION];
|
||||||
|
|
||||||
return p - buf;
|
return p - buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
7
elf.h
7
elf.h
|
@ -16,6 +16,13 @@ struct Fhdr {
|
||||||
int (*readelfphdr)(FILE*, Fhdr*);
|
int (*readelfphdr)(FILE*, Fhdr*);
|
||||||
int (*readelfstrndx)(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 */
|
||||||
|
|
||||||
/* ELF Header */
|
/* ELF Header */
|
||||||
uint16_t type;
|
uint16_t type;
|
||||||
uint16_t machine;
|
uint16_t machine;
|
||||||
|
|
Loading…
Reference in New Issue