[llvm] a921f2a - [llvm-objdump] Add support for the PT_OPENBSD_NOBTCFI segment type. (#67127)

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 22 12:41:01 PDT 2023


Author: Frederic Cambus
Date: 2023-09-22T21:40:58+02:00
New Revision: a921f2a3d721aac0814b6e319b81db1bc46cd3f8

URL: https://github.com/llvm/llvm-project/commit/a921f2a3d721aac0814b6e319b81db1bc46cd3f8
DIFF: https://github.com/llvm/llvm-project/commit/a921f2a3d721aac0814b6e319b81db1bc46cd3f8.diff

LOG: [llvm-objdump] Add support for the PT_OPENBSD_NOBTCFI segment type. (#67127)

Reference: https://github.com/openbsd/src/blob/master/sys/sys/exec_elf.h

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/test/tools/llvm-objdump/openbsd-headers.test b/llvm/test/tools/llvm-objdump/openbsd-headers.test
index 3ac902c1aaffedb..f547854feeeedfe 100644
--- a/llvm/test/tools/llvm-objdump/openbsd-headers.test
+++ b/llvm/test/tools/llvm-objdump/openbsd-headers.test
@@ -9,6 +9,8 @@
 # CHECK-NEXT:      filesz 0x0000000000000000 memsz 0x0000000000000000 flags ---
 # CHECK-NEXT: OPENBSD_WXNEEDED off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**0
 # CHECK-NEXT:      filesz 0x0000000000000000 memsz 0x0000000000000000 flags ---
+# CHECK-NEXT: OPENBSD_NOBTCFI off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**0
+# CHECK-NEXT:      filesz 0x0000000000000000 memsz 0x0000000000000000 flags ---
 # CHECK-NEXT: OPENBSD_BOOTDATA off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**0
 # CHECK-NEXT:      filesz 0x0000000000000000 memsz 0x0000000000000000 flags ---
 
@@ -22,4 +24,5 @@ ProgramHeaders:
   - Type: 0x65a3dbe5 ## PT_OPENBSD_MUTABLE
   - Type: 0x65a3dbe6 ## PT_OPENBSD_RANDOMIZE
   - Type: 0x65a3dbe7 ## PT_OPENBSD_WXNEEDED
+  - Type: 0x65a3dbe8 ## PT_OPENBSD_NOBTCFI
   - Type: 0x65a41be6 ## PT_OPENBSD_BOOTDATA

diff  --git a/llvm/tools/llvm-objdump/ELFDump.cpp b/llvm/tools/llvm-objdump/ELFDump.cpp
index 0920bb3cde50a4a..299a7e3cf3fa523 100644
--- a/llvm/tools/llvm-objdump/ELFDump.cpp
+++ b/llvm/tools/llvm-objdump/ELFDump.cpp
@@ -283,6 +283,9 @@ template <class ELFT> void ELFDumper<ELFT>::printProgramHeaders() {
     case ELF::PT_OPENBSD_MUTABLE:
       outs() << "OPENBSD_MUTABLE ";
       break;
+    case ELF::PT_OPENBSD_NOBTCFI:
+      outs() << "OPENBSD_NOBTCFI ";
+      break;
     case ELF::PT_OPENBSD_RANDOMIZE:
       outs() << "OPENBSD_RANDOMIZE ";
       break;


        


More information about the llvm-commits mailing list