[llvm] r284471 - [llvm-readobj] - Teach readobj to print PT_OPENBSD_RANDOMIZE/PT_OPENBSD_WXNEEDED headers.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 18 03:54:57 PDT 2016
Author: grimar
Date: Tue Oct 18 05:54:56 2016
New Revision: 284471
URL: http://llvm.org/viewvc/llvm-project?rev=284471&view=rev
Log:
[llvm-readobj] - Teach readobj to print PT_OPENBSD_RANDOMIZE/PT_OPENBSD_WXNEEDED headers.
These are OpenBSD specific program headers and
currently we support them in LLD.
Description of headers (just in case) available here:
http://man.openbsd.org/OpenBSD-current/man5/elf.5
OpenBSD commits were:
For PT_OPENBSD_RANDOMIZE:
https://github.com/openbsd/src/commit/c494713c450d98da3f2e1451ee8c7fb675a7c461
For PT_OPENBSD_WXNEEDED:
https://github.com/openbsd/src/commit/2a5a8fc7e30928c2cff57cfe5fb491c90d8478ad
Differential revision: https://reviews.llvm.org/D25616
Added:
llvm/trunk/test/Object/Inputs/openbsd-phdrs.elf-x86-64 (with props)
Modified:
llvm/trunk/test/tools/llvm-readobj/program-headers.test
llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
Added: llvm/trunk/test/Object/Inputs/openbsd-phdrs.elf-x86-64
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/Inputs/openbsd-phdrs.elf-x86-64?rev=284471&view=auto
==============================================================================
Binary file - no diff available.
Propchange: llvm/trunk/test/Object/Inputs/openbsd-phdrs.elf-x86-64
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: llvm/trunk/test/tools/llvm-readobj/program-headers.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/program-headers.test?rev=284471&r1=284470&r2=284471&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/program-headers.test (original)
+++ llvm/trunk/test/tools/llvm-readobj/program-headers.test Tue Oct 18 05:54:56 2016
@@ -7,6 +7,17 @@ RUN: | FileCheck %s -check-prefix EL
RUN: llvm-readobj -program-headers %p/../../Object/Inputs/program-headers.mips64 \
RUN: | FileCheck %s -check-prefix ELF-MIPS64
+## openbsd-phdrs.elf-x86-64 was generated using GNU ld (GNU Binutils for Ubuntu) 2.26.1.
+## llvm-mc -filetype=obj -triple=x86_64-pc-linux test.s -o main.o
+## ld -script linker.script main.o -o openbsd-phdrs.elf-x86-64
+##
+## test.s is an empty file.
+## linker.script:
+## PHDRS { text PT_LOAD FILEHDR PHDRS; foo 0x65a3dbe6; bar 0x65a3dbe7; }
+## SECTIONS { . = SIZEOF_HEADERS; .all : { *(.*) } : text }
+RUN: llvm-readobj -program-headers %p/../../Object/Inputs/openbsd-phdrs.elf-x86-64 \
+RUN: | FileCheck %s -check-prefix OPENBSD-X86-64
+
ELF-I386: ProgramHeaders [
ELF-I386-NEXT: ProgramHeader {
ELF-I386-NEXT: Type: PT_LOAD (0x1)
@@ -140,3 +151,27 @@ ELF-MIPS64-NEXT: ]
ELF-MIPS64-NEXT: Alignment: 65536
ELF-MIPS64-NEXT: }
ELF-MIPS64-NEXT: ]
+
+OPENBSD-X86-64: ProgramHeaders [
+OPENBSD-X86-64: ProgramHeader {
+OPENBSD-X86-64: Type: PT_OPENBSD_RANDOMIZE
+OPENBSD-X86-64-NEXT: Offset:
+OPENBSD-X86-64-NEXT: VirtualAddress:
+OPENBSD-X86-64-NEXT: PhysicalAddress:
+OPENBSD-X86-64-NEXT: FileSize:
+OPENBSD-X86-64-NEXT: MemSize:
+OPENBSD-X86-64-NEXT: Flags [
+OPENBSD-X86-64-NEXT: ]
+OPENBSD-X86-64-NEXT: Alignment:
+OPENBSD-X86-64-NEXT: }
+OPENBSD-X86-64-NEXT: ProgramHeader {
+OPENBSD-X86-64-NEXT: Type: PT_OPENBSD_WXNEEDED
+OPENBSD-X86-64-NEXT: Offset:
+OPENBSD-X86-64-NEXT: VirtualAddress:
+OPENBSD-X86-64-NEXT: PhysicalAddress:
+OPENBSD-X86-64-NEXT: FileSize:
+OPENBSD-X86-64-NEXT: MemSize:
+OPENBSD-X86-64-NEXT: Flags [
+OPENBSD-X86-64-NEXT: ]
+OPENBSD-X86-64-NEXT: Alignment:
+OPENBSD-X86-64-NEXT: }
Modified: llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ELFDumper.cpp?rev=284471&r1=284470&r2=284471&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/ELFDumper.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/ELFDumper.cpp Tue Oct 18 05:54:56 2016
@@ -1154,6 +1154,10 @@ static const char *getElfSegmentType(uns
LLVM_READOBJ_ENUM_CASE(ELF, PT_GNU_STACK);
LLVM_READOBJ_ENUM_CASE(ELF, PT_GNU_RELRO);
+
+ LLVM_READOBJ_ENUM_CASE(ELF, PT_OPENBSD_RANDOMIZE);
+ LLVM_READOBJ_ENUM_CASE(ELF, PT_OPENBSD_WXNEEDED);
+
default: return "";
}
}
More information about the llvm-commits
mailing list