Created attachment 12779 [details] sample test object with PT_OPENBSD_* segments Currently, both objdump/readelf tools do not recognise PT_OPENBSD_* segments, defined as: PT_OPENBSD_RANDOMIZE = 0x65a3dbe6, // Fill with random data. PT_OPENBSD_WXNEEDED = 0x65a3dbe7, // Program does W^X violations. PT_OPENBSD_BOOTDATA = 0x65a41be6, // Section for boot arguments. E.g., "objdump -p 1.o" prints: Program Header: 0x65a3dbe6 off 0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**0 filesz 0x0000000000000000 memsz 0x0000000000000000 flags --- 0x65a3dbe7 off 0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**0 filesz 0x0000000000000000 memsz 0x0000000000000000 flags --- 0x65a41be6 off 0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**0 filesz 0x0000000000000000 memsz 0x0000000000000000 flags --- The expected output is: OPENBSD_RANDOMIZE off 0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**0 filesz 0x0000000000000000 memsz 0x0000000000000000 flags --- OPENBSD_WXNEEDED off 0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**0 filesz 0x0000000000000000 memsz 0x0000000000000000 flags --- OPENBSD_BOOTDATA off 0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**0 filesz 0x0000000000000000 memsz 0x0000000000000000 flags --- "readelf 1.o --program-headers" prints: Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flags Align LOOS+0x5a3dbe6 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x1 LOOS+0x5a3dbe7 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x1 LOOS+0x5a41be6 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x1 The expected output is: Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flags Align OPENBSD_RANDOMIZE 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x1 OPENBSD_WXNEEDED 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x1 OPENBSD_BOOTDATA 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x1
The master branch has been updated by Nick Clifton <nickc@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3eba3ef344b6d22187e50be0dcea883e8254609d commit 3eba3ef344b6d22187e50be0dcea883e8254609d Author: Nick Clifton <nickc@redhat.com> Date: Wed Aug 26 15:13:41 2020 +0100 Add support to readelf for the OpenBSD segment types. PR 26405 binutils* readelf.c (get_segment_type): Handle OpenBSD segment types. include * elf/common.h (PT_OPENBSD_BOOTDATA): Define. (PT_OPENBSD_RANDOMIZE): Define. (PT_OPENBSD_WXNEEDED): Define.
Thanks for reporting this problem. I have now checked in a patch to add the missing definitions to the relevant header file and the decoding to readelf.
Thanks, Nick!