[llvm] r292167 - [llvm-objdump] Dump PT_OPENBSD_{BOOTDATA, RANDOMIZE, WXNEEDED}.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 16 14:01:41 PST 2017


Author: davide
Date: Mon Jan 16 16:01:41 2017
New Revision: 292167

URL: http://llvm.org/viewvc/llvm-project?rev=292167&view=rev
Log:
[llvm-objdump] Dump PT_OPENBSD_{BOOTDATA,RANDOMIZE,WXNEEDED}.

PR: 31641

Added:
    llvm/trunk/test/tools/llvm-objdump/X86/openbsd-headers.test
Modified:
    llvm/trunk/tools/llvm-objdump/ELFDump.cpp

Added: llvm/trunk/test/tools/llvm-objdump/X86/openbsd-headers.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objdump/X86/openbsd-headers.test?rev=292167&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-objdump/X86/openbsd-headers.test (added)
+++ llvm/trunk/test/tools/llvm-objdump/X86/openbsd-headers.test Mon Jan 16 16:01:41 2017
@@ -0,0 +1,20 @@
+## 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; zed 0x65a41be6; }
+##   Where 0x65a3dbe6 is the value of PT_OPENBSD_RANDOMIZE,
+##         0x65a3dbe7 is the value of PT_OPENBSD_WXNEEDED,
+##         0x65a41be6 is the value of PT_OPENBSD_BOOTDATA
+## SECTIONS { . = SIZEOF_HEADERS; .all : { *(.*) } : text }
+RUN: llvm-objdump -p %p/../../../Object/Inputs/openbsd-phdrs.elf-x86-64 \
+RUN:     | FileCheck %s
+
+CHECK: OPENBSD_RANDOMIZE off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**3
+CHECK-NEXT:      filesz 0x0000000000000000 memsz 0x0000000000000000 flags ---
+CHECK-NEXT: OPENBSD_WXNEEDED off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**3
+CHECK-NEXT:      filesz 0x0000000000000000 memsz 0x0000000000000000 flags ---
+CHECK-NEXT: OPENBSD_BOOTDATA off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**3
+CHECK-NEXT:      filesz 0x0000000000000000 memsz 0x0000000000000000 flags ---

Modified: llvm/trunk/tools/llvm-objdump/ELFDump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/ELFDump.cpp?rev=292167&r1=292166&r2=292167&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/ELFDump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/ELFDump.cpp Mon Jan 16 16:01:41 2017
@@ -45,6 +45,15 @@ template <class ELFT> void printProgramH
     case ELF::PT_LOAD:
       outs() << "    LOAD ";
       break;
+    case ELF::PT_OPENBSD_BOOTDATA:
+      outs() << "    OPENBSD_BOOTDATA ";
+      break;
+    case ELF::PT_OPENBSD_RANDOMIZE:
+      outs() << "    OPENBSD_RANDOMIZE ";
+      break;
+    case ELF::PT_OPENBSD_WXNEEDED:
+      outs() << "    OPENBSD_WXNEEDED ";
+      break;
     case ELF::PT_PHDR:
       outs() << "    PHDR ";
       break;




More information about the llvm-commits mailing list