I'm actually studying the unix objdump command.
I want to retrieve the flags showed by the command "objdump -f file"
Here is an example
$>objdump -f /bin/ls
/bin/ls: file format elf64-x86-64 architecture: i386:x86-64, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x0000000000404e68
I know that I can obtain 112 by making an | on the flags that are bitmasks defined in BSD lib. The masks are:
#define BFD_NO_FLAGS 0x00
#define HAS_RELOC 0x01
#define EXEC_P 0x02
#define HAS_LINENO 0x04
#define HAS_DEBUG 0x08
#define HAS_SYMS 0x10
#define HAS_LOCALS 0x20
#define DYNAMIC 0x40
#define WP_TEXT 0x80
#define D_PAGED 0x100
Thanks to the elf struct and the e_type attribute I can obtain the HAS_RELOC flag and the EXEC_P flag.
How can I obtain the others?
Have I to retrieve 112 to get the flags or have I to retrieve the flags one by one? .
User contributions licensed under CC BY-SA 3.0