objdump

objdump - head ELF - Meaning of flags?


$ objdump -f ./a.out

./a.out:     file format elf32-i386
architecture: i386, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x080484e0

$ objdump -f function.o

function.o:     file format elf32-i386
architecture: i386, flags 0x00000011:
HAS_RELOC, HAS_SYMS
start address 0x00000000

What is the meaning of flags 0x00000011 and 0x00000112? Nothing in the ELF header file has this flag.

Does someone have an idea about their meaning?


Solution

  • They are BFD-specific bitmasks. In the binutils source tree, see bfd/bfd-in2.h:

      /* BFD contains relocation entries.  */
    #define HAS_RELOC      0x01
    
      /* BFD is directly executable.  */
    #define EXEC_P         0x02
    ...
      /* BFD has symbols.  */
    #define HAS_SYMS       0x10
    ...
      /* BFD is dynamically paged (this is like an a.out ZMAGIC file) (the
         linker sets this by default, but clears it for -r or -n or -N).  */
    #define D_PAGED        0x100
    

    These flag values won't appear in your object file; they are simply an in-memory representation that libbfd uses.