[llvm-branch-commits] [llvm] release/18.x: [llvm-objdump] Add support for the PT_OPENBSD_SYSCALLS segment type. (#82121) (PR #82317)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Feb 20 11:59:54 PST 2024


https://github.com/llvmbot updated https://github.com/llvm/llvm-project/pull/82317

>From 12114d2d5a66cf4cb656a6dd83bb17704f2261a0 Mon Sep 17 00:00:00 2001
From: Frederic Cambus <fred at statdns.com>
Date: Tue, 20 Feb 2024 09:11:54 +0100
Subject: [PATCH] [llvm-objdump] Add support for the PT_OPENBSD_SYSCALLS
 segment type. (#82121)

Reference: https://github.com/openbsd/src/blob/master/sys/sys/exec_elf.h
(cherry picked from commit 1b894864862d8049e4a2567a472efdc2eda1e035)
---
 llvm/test/tools/llvm-objdump/openbsd-headers.test | 3 +++
 llvm/tools/llvm-objdump/ELFDump.cpp               | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/llvm/test/tools/llvm-objdump/openbsd-headers.test b/llvm/test/tools/llvm-objdump/openbsd-headers.test
index f547854feeeedf..84fa59bdf89f5c 100644
--- a/llvm/test/tools/llvm-objdump/openbsd-headers.test
+++ b/llvm/test/tools/llvm-objdump/openbsd-headers.test
@@ -11,6 +11,8 @@
 # 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_SYSCALLS 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 ---
 
@@ -25,4 +27,5 @@ ProgramHeaders:
   - Type: 0x65a3dbe6 ## PT_OPENBSD_RANDOMIZE
   - Type: 0x65a3dbe7 ## PT_OPENBSD_WXNEEDED
   - Type: 0x65a3dbe8 ## PT_OPENBSD_NOBTCFI
+  - Type: 0x65a3dbe9 ## PT_OPENBSD_SYSCALLS
   - Type: 0x65a41be6 ## PT_OPENBSD_BOOTDATA
diff --git a/llvm/tools/llvm-objdump/ELFDump.cpp b/llvm/tools/llvm-objdump/ELFDump.cpp
index 34861ee92128fd..fda99bd6d33e17 100644
--- a/llvm/tools/llvm-objdump/ELFDump.cpp
+++ b/llvm/tools/llvm-objdump/ELFDump.cpp
@@ -291,6 +291,9 @@ template <class ELFT> void ELFDumper<ELFT>::printProgramHeaders() {
     case ELF::PT_OPENBSD_RANDOMIZE:
       outs() << "OPENBSD_RANDOMIZE ";
       break;
+    case ELF::PT_OPENBSD_SYSCALLS:
+      outs() << "OPENBSD_SYSCALLS ";
+      break;
     case ELF::PT_OPENBSD_WXNEEDED:
       outs() << "OPENBSD_WXNEEDED ";
       break;



More information about the llvm-branch-commits mailing list