mirror of https://github.com/0intro/libelf
add elfosabi function
This commit is contained in:
parent
859ed02491
commit
f6cc9faf01
|
@ -68,6 +68,7 @@ uint8_t* readelfsection(FILE *f, char *name, uint64_t *size, Fhdr *fp);
|
|||
void freeelf(Fhdr *fp);
|
||||
char* elfclass(uint8_t class);
|
||||
char* elfdata(uint8_t data);
|
||||
char* elfosabi(uint8_t osabi);
|
||||
char* elftype(uint16_t type);
|
||||
char* elfmachine(uint16_t machine);
|
||||
char* elfversion(uint8_t version);
|
||||
|
|
1
elf.h
1
elf.h
|
@ -52,6 +52,7 @@ uint8_t* readelfsection(FILE*, char*, uint64_t*, Fhdr*);
|
|||
void freeelf(Fhdr*);
|
||||
char* elfclass(uint8_t);
|
||||
char* elfdata(uint8_t);
|
||||
char* elfosabi(uint8_t);
|
||||
char* elftype(uint16_t);
|
||||
char* elfmachine(uint16_t);
|
||||
char* elfversion(uint8_t);
|
||||
|
|
29
str.c
29
str.c
|
@ -32,6 +32,35 @@ elfdata(uint8_t data)
|
|||
return "Unknown data";
|
||||
}
|
||||
|
||||
static char* osabistr[] = {
|
||||
[ELFOSABI_NONE] = "No extensions or unspecified",
|
||||
[ELFOSABI_HPUX] = "Hewlett-Packard HP-UX",
|
||||
[ELFOSABI_NETBSD] = "NetBSD",
|
||||
[ELFOSABI_GNU] = "GNU ",
|
||||
[ELFOSABI_SOLARIS] = "Sun Solaris",
|
||||
[ELFOSABI_AIX] = "AIX",
|
||||
[ELFOSABI_IRIX] = "IRIX",
|
||||
[ELFOSABI_FREEBSD] = "FreeBSD",
|
||||
[ELFOSABI_TRU64] = "Compaq TRU64 UNIX",
|
||||
[ELFOSABI_MODESTO] = "Novell Modesto",
|
||||
[ELFOSABI_OPENBSD] = "Open BSD",
|
||||
[ELFOSABI_OPENVMS] = "Open VMS",
|
||||
[ELFOSABI_NSK] = "Hewlett-Packard Non-Stop Kernel",
|
||||
[ELFOSABI_AROS] = "Amiga Research OS",
|
||||
[ELFOSABI_FENIXOS] = "The FenixOS highly scalable multi-core OS",
|
||||
[ELFOSABI_CLOUDABI] = "Nuxi CloudABI",
|
||||
[ELFOSABI_OPENVOS] = "Stratus Technologies OpenVOS",
|
||||
};
|
||||
|
||||
char*
|
||||
elfosabi(uint8_t data)
|
||||
{
|
||||
if(data < nelem(osabistr) && osabistr[data])
|
||||
return osabistr[data];
|
||||
|
||||
return "Unknown osabi";
|
||||
}
|
||||
|
||||
char *machinestr[] = {
|
||||
[EM_NONE] = "No machine",
|
||||
[EM_M32] = "AT&T WE 32100",
|
||||
|
|
Loading…
Reference in New Issue