[llvm] 96c037e - [llvm] - Recognizing 'PT_OPENBSD_MUTABLE' segment type.

Brad Smith via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 18 17:42:56 PST 2022


Author: Brad Smith
Date: 2022-11-18T20:42:10-05:00
New Revision: 96c037ef9c01e5e26c84e571feb3e5c16519727d

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

LOG: [llvm] - Recognizing 'PT_OPENBSD_MUTABLE' segment type.

Recognizing 'PT_OPENBSD_MUTABLE' segment type.

https://github.com/openbsd/src/commit/bd249b5664da50f0178adea78250a7a0d8ea6566

Reviewed By: jhenderson, MaskRay

Differential Revision: https://reviews.llvm.org/D137903

Added: 
    

Modified: 
    llvm/test/tools/llvm-objdump/openbsd-headers.test
    llvm/test/tools/llvm-readobj/ELF/program-headers.test
    llvm/tools/llvm-objdump/ELFDump.cpp
    llvm/tools/llvm-readobj/ELFDumper.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/test/tools/llvm-objdump/openbsd-headers.test b/llvm/test/tools/llvm-objdump/openbsd-headers.test
index 7ff1c5390c2d5..3ac902c1aaffe 100644
--- a/llvm/test/tools/llvm-objdump/openbsd-headers.test
+++ b/llvm/test/tools/llvm-objdump/openbsd-headers.test
@@ -3,7 +3,9 @@
 # RUN: yaml2obj %s -o %t
 # RUN: llvm-objdump -p %t | FileCheck %s
 
-# CHECK:      OPENBSD_RANDOMIZE off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**0
+# CHECK:      OPENBSD_MUTABLE off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**0
+# CHECK-NEXT:      filesz 0x0000000000000000 memsz 0x0000000000000000 flags ---
+# CHECK-NEXT: OPENBSD_RANDOMIZE off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**0
 # 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 ---
@@ -17,6 +19,7 @@ FileHeader:
   Type:    ET_EXEC
   Machine: EM_X86_64
 ProgramHeaders:
+  - Type: 0x65a3dbe5 ## PT_OPENBSD_MUTABLE
   - Type: 0x65a3dbe6 ## PT_OPENBSD_RANDOMIZE
   - Type: 0x65a3dbe7 ## PT_OPENBSD_WXNEEDED
   - Type: 0x65a41be6 ## PT_OPENBSD_BOOTDATA

diff  --git a/llvm/test/tools/llvm-readobj/ELF/program-headers.test b/llvm/test/tools/llvm-readobj/ELF/program-headers.test
index 2ecf335250683..087876adc29a9 100644
--- a/llvm/test/tools/llvm-readobj/ELF/program-headers.test
+++ b/llvm/test/tools/llvm-readobj/ELF/program-headers.test
@@ -29,64 +29,66 @@
 # RUN:   FileCheck %s --check-prefixes=ELF64,MAPPING --strict-whitespace --match-full-lines
 # RUN: llvm-readobj -l %t64.elf | FileCheck %s --check-prefixes=ELF-LLVM,ELF64-LLVM
 
-#       ELF32:There are 23 program headers, starting at offset 52
+#       ELF32:There are 24 program headers, starting at offset 52
 # ELF32-EMPTY:
 # ELF32-NEXT:Program Headers:
 # ELF32-NEXT:  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
-# ELF32-NEXT:  PHDR           0x000314 0x00001000 0x00001000 0x00003 0x00003  W  0x1
-# ELF32-NEXT:  PHDR           0x000317 0x00002000 0x00002000 0x00007 0x00007   E 0x1
-# ELF32-NEXT:  NULL           0x000317 0x00002000 0x00002000 0x00007 0x00007   E 0x1
-# ELF32-NEXT:  DYNAMIC        0x000314 0x00001000 0x00001000 0x00003 0x00003 RWE 0x1
-# ELF32-NEXT:  INTERP         0x00031e 0x00003000 0x00003000 0x00004 0x00004 RW  0x1
+# ELF32-NEXT:  PHDR           0x000334 0x00001000 0x00001000 0x00003 0x00003  W  0x1
+# ELF32-NEXT:  PHDR           0x000337 0x00002000 0x00002000 0x00007 0x00007   E 0x1
+# ELF32-NEXT:  NULL           0x000337 0x00002000 0x00002000 0x00007 0x00007   E 0x1
+# ELF32-NEXT:  DYNAMIC        0x000334 0x00001000 0x00001000 0x00003 0x00003 RWE 0x1
+# ELF32-NEXT:  INTERP         0x00033e 0x00003000 0x00003000 0x00004 0x00004 RW  0x1
 # ELF32-NEXT:      [Requesting program interpreter: ABC]
-# ELF32-NEXT:  NOTE           0x000314 0x00001000 0x00001000 0x00003 0x00003     0x1
-# ELF32-NEXT:  SHLIB          0x000314 0x00001000 0x00001000 0x00001 0x00001     0x1
-# ELF32-NEXT:  TLS            0x000322 0x00004000 0x00004000 0x00001 0x00001     0x1
-# ELF32-NEXT:  <unknown>: 0x60000000 0x000314 0x00001000 0x00001000 0x00003 0x00003     0x1
-# ELF32-NEXT:  GNU_EH_FRAME   0x000314 0x00001000 0x00001000 0x00003 0x00003     0x1
-# ELF32-NEXT:  SUNW_UNWIND    0x000314 0x00001000 0x00001000 0x00003 0x00003     0x1
-# ELF32-NEXT:  GNU_STACK      0x000314 0x00001000 0x00001000 0x00003 0x00003     0x1
-# ELF32-NEXT:  GNU_RELRO      0x000314 0x00001000 0x00001000 0x00003 0x00003     0x1
-# ELF32-NEXT:  GNU_PROPERTY   0x000314 0x00001000 0x00001000 0x00003 0x00003     0x1
-# ELF32-NEXT:  OPENBSD_RANDOMIZE 0x000314 0x00001000 0x00001000 0x00003 0x00003     0x1
-# ELF32-NEXT:  OPENBSD_WXNEEDED 0x000314 0x00001000 0x00001000 0x00003 0x00003     0x1
-# ELF32-NEXT:  OPENBSD_BOOTDATA 0x000314 0x00001000 0x00001000 0x00003 0x00003     0x1
-# ELF32-NEXT:  <unknown>: 0x6fffffff 0x000314 0x00001000 0x00001000 0x00003 0x00003     0x1
-# ELF32-NEXT:  <unknown>: 0x70000000 0x000314 0x00001000 0x00001000 0x00003 0x00003     0x1
-# ELF32-NEXT:  <unknown>: 0x70000001 0x000314 0x00001000 0x00001000 0x00003 0x00003     0x1
-# ELF32-NEXT:  <unknown>: 0x70000002 0x000314 0x00001000 0x00001000 0x00003 0x00003     0x1
-# ELF32-NEXT:  <unknown>: 0x70000003 0x000314 0x00001000 0x00001000 0x00003 0x00003     0x1
-# ELF32-NEXT:  <unknown>: 0x7fffffff 0x000314 0x00001000 0x00001000 0x00003 0x00003     0x1
+# ELF32-NEXT:  NOTE           0x000334 0x00001000 0x00001000 0x00003 0x00003     0x1
+# ELF32-NEXT:  SHLIB          0x000334 0x00001000 0x00001000 0x00001 0x00001     0x1
+# ELF32-NEXT:  TLS            0x000342 0x00004000 0x00004000 0x00001 0x00001     0x1
+# ELF32-NEXT:  <unknown>: 0x60000000 0x000334 0x00001000 0x00001000 0x00003 0x00003     0x1
+# ELF32-NEXT:  GNU_EH_FRAME   0x000334 0x00001000 0x00001000 0x00003 0x00003     0x1
+# ELF32-NEXT:  SUNW_UNWIND    0x000334 0x00001000 0x00001000 0x00003 0x00003     0x1
+# ELF32-NEXT:  GNU_STACK      0x000334 0x00001000 0x00001000 0x00003 0x00003     0x1
+# ELF32-NEXT:  GNU_RELRO      0x000334 0x00001000 0x00001000 0x00003 0x00003     0x1
+# ELF32-NEXT:  GNU_PROPERTY   0x000334 0x00001000 0x00001000 0x00003 0x00003     0x1
+# ELF32-NEXT:  OPENBSD_MUTABLE 0x000334 0x00001000 0x00001000 0x00003 0x00003     0x1
+# ELF32-NEXT:  OPENBSD_RANDOMIZE 0x000334 0x00001000 0x00001000 0x00003 0x00003     0x1
+# ELF32-NEXT:  OPENBSD_WXNEEDED 0x000334 0x00001000 0x00001000 0x00003 0x00003     0x1
+# ELF32-NEXT:  OPENBSD_BOOTDATA 0x000334 0x00001000 0x00001000 0x00003 0x00003     0x1
+# ELF32-NEXT:  <unknown>: 0x6fffffff 0x000334 0x00001000 0x00001000 0x00003 0x00003     0x1
+# ELF32-NEXT:  <unknown>: 0x70000000 0x000334 0x00001000 0x00001000 0x00003 0x00003     0x1
+# ELF32-NEXT:  <unknown>: 0x70000001 0x000334 0x00001000 0x00001000 0x00003 0x00003     0x1
+# ELF32-NEXT:  <unknown>: 0x70000002 0x000334 0x00001000 0x00001000 0x00003 0x00003     0x1
+# ELF32-NEXT:  <unknown>: 0x70000003 0x000334 0x00001000 0x00001000 0x00003 0x00003     0x1
+# ELF32-NEXT:  <unknown>: 0x7fffffff 0x000334 0x00001000 0x00001000 0x00003 0x00003     0x1
 # ELF32-EMPTY:
 
-#       ELF64:There are 23 program headers, starting at offset 64
+#       ELF64:There are 24 program headers, starting at offset 64
 # ELF64-EMPTY:
 # ELF64-NEXT:Program Headers:
 # ELF64-NEXT:  Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
-# ELF64-NEXT:  PHDR           0x000548 0x0000000000001000 0x0000000000001000 0x000003 0x000003  W  0x1
-# ELF64-NEXT:  PHDR           0x00054b 0x0000000000002000 0x0000000000002000 0x000007 0x000007   E 0x1
-# ELF64-NEXT:  NULL           0x00054b 0x0000000000002000 0x0000000000002000 0x000007 0x000007   E 0x1
-# ELF64-NEXT:  DYNAMIC        0x000548 0x0000000000001000 0x0000000000001000 0x000003 0x000003 RWE 0x1
-# ELF64-NEXT:  INTERP         0x000552 0x0000000000003000 0x0000000000003000 0x000004 0x000004 RW  0x1
+# ELF64-NEXT:  PHDR           0x000580 0x0000000000001000 0x0000000000001000 0x000003 0x000003  W  0x1
+# ELF64-NEXT:  PHDR           0x000583 0x0000000000002000 0x0000000000002000 0x000007 0x000007   E 0x1
+# ELF64-NEXT:  NULL           0x000583 0x0000000000002000 0x0000000000002000 0x000007 0x000007   E 0x1
+# ELF64-NEXT:  DYNAMIC        0x000580 0x0000000000001000 0x0000000000001000 0x000003 0x000003 RWE 0x1
+# ELF64-NEXT:  INTERP         0x00058a 0x0000000000003000 0x0000000000003000 0x000004 0x000004 RW  0x1
 # ELF64-NEXT:      [Requesting program interpreter: ABC]
-# ELF64-NEXT:  NOTE           0x000548 0x0000000000001000 0x0000000000001000 0x000003 0x000003     0x1
-# ELF64-NEXT:  SHLIB          0x000548 0x0000000000001000 0x0000000000001000 0x000001 0x000001     0x1
-# ELF64-NEXT:  TLS            0x000556 0x0000000000004000 0x0000000000004000 0x000001 0x000001     0x1
-# ELF64-NEXT:  <unknown>: 0x60000000 0x000548 0x0000000000001000 0x0000000000001000 0x000003 0x000003     0x1
-# ELF64-NEXT:  GNU_EH_FRAME   0x000548 0x0000000000001000 0x0000000000001000 0x000003 0x000003     0x1
-# ELF64-NEXT:  SUNW_UNWIND    0x000548 0x0000000000001000 0x0000000000001000 0x000003 0x000003     0x1
-# ELF64-NEXT:  GNU_STACK      0x000548 0x0000000000001000 0x0000000000001000 0x000003 0x000003     0x1
-# ELF64-NEXT:  GNU_RELRO      0x000548 0x0000000000001000 0x0000000000001000 0x000003 0x000003     0x1
-# ELF64-NEXT:  GNU_PROPERTY   0x000548 0x0000000000001000 0x0000000000001000 0x000003 0x000003     0x1
-# ELF64-NEXT:  OPENBSD_RANDOMIZE 0x000548 0x0000000000001000 0x0000000000001000 0x000003 0x000003     0x1
-# ELF64-NEXT:  OPENBSD_WXNEEDED 0x000548 0x0000000000001000 0x0000000000001000 0x000003 0x000003     0x1
-# ELF64-NEXT:  OPENBSD_BOOTDATA 0x000548 0x0000000000001000 0x0000000000001000 0x000003 0x000003     0x1
-# ELF64-NEXT:  <unknown>: 0x6fffffff 0x000548 0x0000000000001000 0x0000000000001000 0x000003 0x000003     0x1
-# ELF64-NEXT:  <unknown>: 0x70000000 0x000548 0x0000000000001000 0x0000000000001000 0x000003 0x000003     0x1
-# ELF64-NEXT:  <unknown>: 0x70000001 0x000548 0x0000000000001000 0x0000000000001000 0x000003 0x000003     0x1
-# ELF64-NEXT:  <unknown>: 0x70000002 0x000548 0x0000000000001000 0x0000000000001000 0x000003 0x000003     0x1
-# ELF64-NEXT:  <unknown>: 0x70000003 0x000548 0x0000000000001000 0x0000000000001000 0x000003 0x000003     0x1
-# ELF64-NEXT:  <unknown>: 0x7fffffff 0x000548 0x0000000000001000 0x0000000000001000 0x000003 0x000003     0x1
+# ELF64-NEXT:  NOTE           0x000580 0x0000000000001000 0x0000000000001000 0x000003 0x000003     0x1
+# ELF64-NEXT:  SHLIB          0x000580 0x0000000000001000 0x0000000000001000 0x000001 0x000001     0x1
+# ELF64-NEXT:  TLS            0x00058e 0x0000000000004000 0x0000000000004000 0x000001 0x000001     0x1
+# ELF64-NEXT:  <unknown>: 0x60000000 0x000580 0x0000000000001000 0x0000000000001000 0x000003 0x000003     0x1
+# ELF64-NEXT:  GNU_EH_FRAME   0x000580 0x0000000000001000 0x0000000000001000 0x000003 0x000003     0x1
+# ELF64-NEXT:  SUNW_UNWIND    0x000580 0x0000000000001000 0x0000000000001000 0x000003 0x000003     0x1
+# ELF64-NEXT:  GNU_STACK      0x000580 0x0000000000001000 0x0000000000001000 0x000003 0x000003     0x1
+# ELF64-NEXT:  GNU_RELRO      0x000580 0x0000000000001000 0x0000000000001000 0x000003 0x000003     0x1
+# ELF64-NEXT:  GNU_PROPERTY   0x000580 0x0000000000001000 0x0000000000001000 0x000003 0x000003     0x1
+# ELF64-NEXT:  OPENBSD_MUTABLE 0x000580 0x0000000000001000 0x0000000000001000 0x000003 0x000003     0x1
+# ELF64-NEXT:  OPENBSD_RANDOMIZE 0x000580 0x0000000000001000 0x0000000000001000 0x000003 0x000003     0x1
+# ELF64-NEXT:  OPENBSD_WXNEEDED 0x000580 0x0000000000001000 0x0000000000001000 0x000003 0x000003     0x1
+# ELF64-NEXT:  OPENBSD_BOOTDATA 0x000580 0x0000000000001000 0x0000000000001000 0x000003 0x000003     0x1
+# ELF64-NEXT:  <unknown>: 0x6fffffff 0x000580 0x0000000000001000 0x0000000000001000 0x000003 0x000003     0x1
+# ELF64-NEXT:  <unknown>: 0x70000000 0x000580 0x0000000000001000 0x0000000000001000 0x000003 0x000003     0x1
+# ELF64-NEXT:  <unknown>: 0x70000001 0x000580 0x0000000000001000 0x0000000000001000 0x000003 0x000003     0x1
+# ELF64-NEXT:  <unknown>: 0x70000002 0x000580 0x0000000000001000 0x0000000000001000 0x000003 0x000003     0x1
+# ELF64-NEXT:  <unknown>: 0x70000003 0x000580 0x0000000000001000 0x0000000000001000 0x000003 0x000003     0x1
+# ELF64-NEXT:  <unknown>: 0x7fffffff 0x000580 0x0000000000001000 0x0000000000001000 0x000003 0x000003     0x1
 # ELF64-EMPTY:
 
 #      MAPPING: Section to Segment mapping:
@@ -114,13 +116,14 @@
 # MAPPING-NEXT:   20     .foo.begin .foo.end {{$}}
 # MAPPING-NEXT:   21     .foo.begin .foo.end {{$}}
 # MAPPING-NEXT:   22     .foo.begin .foo.end {{$}}
+# MAPPING-NEXT:   23     .foo.begin .foo.end {{$}}
 # MAPPING-NEXT:   None   .unused .strtab .shstrtab {{$}}
 
 # ELF-LLVM:      ProgramHeaders [
 # ELF-LLVM-NEXT:   ProgramHeader {
 # ELF-LLVM-NEXT:     Type: PT_PHDR (0x6)
-# ELF32-LLVM-NEXT:   Offset: 0x314
-# ELF64-LLVM-NEXT:   Offset: 0x548
+# ELF32-LLVM-NEXT:   Offset: 0x334
+# ELF64-LLVM-NEXT:   Offset: 0x580
 # ELF-LLVM-NEXT:     VirtualAddress: 0x1000
 # ELF-LLVM-NEXT:     PhysicalAddress: 0x1000
 # ELF-LLVM-NEXT:     FileSize: 3
@@ -132,8 +135,8 @@
 # ELF-LLVM-NEXT:   }
 # ELF-LLVM-NEXT:   ProgramHeader {
 # ELF-LLVM-NEXT:     Type: PT_PHDR (0x6)
-# ELF32-LLVM-NEXT:   Offset: 0x317
-# ELF64-LLVM-NEXT:   Offset: 0x54B
+# ELF32-LLVM-NEXT:   Offset: 0x337
+# ELF64-LLVM-NEXT:   Offset: 0x583
 # ELF-LLVM-NEXT:     VirtualAddress: 0x2000
 # ELF-LLVM-NEXT:     PhysicalAddress: 0x2000
 # ELF-LLVM-NEXT:     FileSize: 7
@@ -145,8 +148,8 @@
 # ELF-LLVM-NEXT:   }
 # ELF-LLVM-NEXT:   ProgramHeader {
 # ELF-LLVM-NEXT:     Type: PT_NULL (0x0)
-# ELF32-LLVM-NEXT:   Offset: 0x317
-# ELF64-LLVM-NEXT:   Offset: 0x54B
+# ELF32-LLVM-NEXT:   Offset: 0x337
+# ELF64-LLVM-NEXT:   Offset: 0x583
 # ELF-LLVM-NEXT:     VirtualAddress: 0x2000
 # ELF-LLVM-NEXT:     PhysicalAddress: 0x2000
 # ELF-LLVM-NEXT:     FileSize: 7
@@ -158,8 +161,8 @@
 # ELF-LLVM-NEXT:   }
 # ELF-LLVM-NEXT:   ProgramHeader {
 # ELF-LLVM-NEXT:     Type: PT_DYNAMIC (0x2)
-# ELF32-LLVM-NEXT:   Offset: 0x314
-# ELF64-LLVM-NEXT:   Offset: 0x548
+# ELF32-LLVM-NEXT:   Offset: 0x334
+# ELF64-LLVM-NEXT:   Offset: 0x580
 # ELF-LLVM-NEXT:     VirtualAddress: 0x1000
 # ELF-LLVM-NEXT:     PhysicalAddress: 0x1000
 # ELF-LLVM-NEXT:     FileSize: 3
@@ -173,8 +176,8 @@
 # ELF-LLVM-NEXT:   }
 # ELF-LLVM-NEXT:   ProgramHeader {
 # ELF-LLVM-NEXT:     Type: PT_INTERP (0x3)
-# ELF32-LLVM-NEXT:   Offset: 0x31E
-# ELF64-LLVM-NEXT:   Offset: 0x552
+# ELF32-LLVM-NEXT:   Offset: 0x33E
+# ELF64-LLVM-NEXT:   Offset: 0x58A
 # ELF-LLVM-NEXT:     VirtualAddress: 0x3000
 # ELF-LLVM-NEXT:     PhysicalAddress: 0x3000
 # ELF-LLVM-NEXT:     FileSize: 4
@@ -187,8 +190,8 @@
 # ELF-LLVM-NEXT:   }
 # ELF-LLVM-NEXT:   ProgramHeader {
 # ELF-LLVM-NEXT:     Type: PT_NOTE (0x4)
-# ELF32-LLVM-NEXT:   Offset: 0x314
-# ELF64-LLVM-NEXT:   Offset: 0x548
+# ELF32-LLVM-NEXT:   Offset: 0x334
+# ELF64-LLVM-NEXT:   Offset: 0x580
 # ELF-LLVM-NEXT:     VirtualAddress: 0x1000
 # ELF-LLVM-NEXT:     PhysicalAddress: 0x1000
 # ELF-LLVM-NEXT:     FileSize: 3
@@ -199,8 +202,8 @@
 # ELF-LLVM-NEXT:   }
 # ELF-LLVM-NEXT:   ProgramHeader {
 # ELF-LLVM-NEXT:     Type: PT_SHLIB (0x5)
-# ELF32-LLVM-NEXT:   Offset: 0x314
-# ELF64-LLVM-NEXT:   Offset: 0x548
+# ELF32-LLVM-NEXT:   Offset: 0x334
+# ELF64-LLVM-NEXT:   Offset: 0x580
 # ELF-LLVM-NEXT:     VirtualAddress: 0x1000
 # ELF-LLVM-NEXT:     PhysicalAddress: 0x1000
 # ELF-LLVM-NEXT:     FileSize: 1
@@ -211,8 +214,8 @@
 # ELF-LLVM-NEXT:   }
 # ELF-LLVM-NEXT:   ProgramHeader {
 # ELF-LLVM-NEXT:     Type: PT_TLS (0x7)
-# ELF32-LLVM-NEXT:   Offset: 0x322
-# ELF64-LLVM-NEXT:   Offset: 0x556
+# ELF32-LLVM-NEXT:   Offset: 0x342
+# ELF64-LLVM-NEXT:   Offset: 0x58E
 # ELF-LLVM-NEXT:     VirtualAddress: 0x4000
 # ELF-LLVM-NEXT:     PhysicalAddress: 0x4000
 # ELF-LLVM-NEXT:     FileSize: 1
@@ -223,8 +226,8 @@
 # ELF-LLVM-NEXT:   }
 # ELF-LLVM-NEXT:   ProgramHeader {
 # ELF-LLVM-NEXT:     Type: Unknown (0x60000000)
-# ELF32-LLVM-NEXT:   Offset: 0x314
-# ELF64-LLVM-NEXT:   Offset: 0x548
+# ELF32-LLVM-NEXT:   Offset: 0x334
+# ELF64-LLVM-NEXT:   Offset: 0x580
 # ELF-LLVM-NEXT:     VirtualAddress: 0x1000
 # ELF-LLVM-NEXT:     PhysicalAddress: 0x1000
 # ELF-LLVM-NEXT:     FileSize: 3
@@ -235,8 +238,8 @@
 # ELF-LLVM-NEXT:   }
 # ELF-LLVM-NEXT:   ProgramHeader {
 # ELF-LLVM-NEXT:     Type: PT_GNU_EH_FRAME (0x6474E550)
-# ELF32-LLVM-NEXT:   Offset: 0x314
-# ELF64-LLVM-NEXT:   Offset: 0x548
+# ELF32-LLVM-NEXT:   Offset: 0x334
+# ELF64-LLVM-NEXT:   Offset: 0x580
 # ELF-LLVM-NEXT:     VirtualAddress: 0x1000
 # ELF-LLVM-NEXT:     PhysicalAddress: 0x1000
 # ELF-LLVM-NEXT:     FileSize: 3
@@ -247,8 +250,8 @@
 # ELF-LLVM-NEXT:   }
 # ELF-LLVM-NEXT:   ProgramHeader {
 # ELF-LLVM-NEXT:     Type: PT_SUNW_UNWIND (0x6464E550)
-# ELF32-LLVM-NEXT:   Offset: 0x314
-# ELF64-LLVM-NEXT:   Offset: 0x548
+# ELF32-LLVM-NEXT:   Offset: 0x334
+# ELF64-LLVM-NEXT:   Offset: 0x580
 # ELF-LLVM-NEXT:     VirtualAddress: 0x1000
 # ELF-LLVM-NEXT:     PhysicalAddress: 0x1000
 # ELF-LLVM-NEXT:     FileSize: 3
@@ -259,8 +262,8 @@
 # ELF-LLVM-NEXT:   }
 # ELF-LLVM-NEXT:   ProgramHeader {
 # ELF-LLVM-NEXT:     Type: PT_GNU_STACK (0x6474E551)
-# ELF32-LLVM-NEXT:   Offset: 0x314
-# ELF64-LLVM-NEXT:   Offset: 0x548
+# ELF32-LLVM-NEXT:   Offset: 0x334
+# ELF64-LLVM-NEXT:   Offset: 0x580
 # ELF-LLVM-NEXT:     VirtualAddress: 0x1000
 # ELF-LLVM-NEXT:     PhysicalAddress: 0x1000
 # ELF-LLVM-NEXT:     FileSize: 3
@@ -271,8 +274,8 @@
 # ELF-LLVM-NEXT:   }
 # ELF-LLVM-NEXT:   ProgramHeader {
 # ELF-LLVM-NEXT:     Type: PT_GNU_RELRO (0x6474E552)
-# ELF32-LLVM-NEXT:   Offset: 0x314
-# ELF64-LLVM-NEXT:   Offset: 0x548
+# ELF32-LLVM-NEXT:   Offset: 0x334
+# ELF64-LLVM-NEXT:   Offset: 0x580
 # ELF-LLVM-NEXT:     VirtualAddress: 0x1000
 # ELF-LLVM-NEXT:     PhysicalAddress: 0x1000
 # ELF-LLVM-NEXT:     FileSize: 3
@@ -283,8 +286,20 @@
 # ELF-LLVM-NEXT:   }
 # ELF-LLVM-NEXT:   ProgramHeader {
 # ELF-LLVM-NEXT:     Type: PT_GNU_PROPERTY (0x6474E553)
-# ELF32-LLVM-NEXT:   Offset: 0x314
-# ELF64-LLVM-NEXT:   Offset: 0x548
+# ELF32-LLVM-NEXT:   Offset: 0x334
+# ELF64-LLVM-NEXT:   Offset: 0x580
+# ELF-LLVM-NEXT:     VirtualAddress: 0x1000
+# ELF-LLVM-NEXT:     PhysicalAddress: 0x1000
+# ELF-LLVM-NEXT:     FileSize: 3
+# ELF-LLVM-NEXT:     MemSize: 3
+# ELF-LLVM-NEXT:     Flags [ (0x0)
+# ELF-LLVM-NEXT:     ]
+# ELF-LLVM-NEXT:     Alignment: 1
+# ELF-LLVM-NEXT:   }
+# ELF-LLVM-NEXT:   ProgramHeader {
+# ELF-LLVM-NEXT:     Type: PT_OPENBSD_MUTABLE (0x65A3DBE5)
+# ELF32-LLVM-NEXT:   Offset: 0x334
+# ELF64-LLVM-NEXT:   Offset: 0x580
 # ELF-LLVM-NEXT:     VirtualAddress: 0x1000
 # ELF-LLVM-NEXT:     PhysicalAddress: 0x1000
 # ELF-LLVM-NEXT:     FileSize: 3
@@ -295,8 +310,8 @@
 # ELF-LLVM-NEXT:   }
 # ELF-LLVM-NEXT:   ProgramHeader {
 # ELF-LLVM-NEXT:     Type: PT_OPENBSD_RANDOMIZE (0x65A3DBE6)
-# ELF32-LLVM-NEXT:   Offset: 0x314
-# ELF64-LLVM-NEXT:   Offset: 0x548
+# ELF32-LLVM-NEXT:   Offset: 0x334
+# ELF64-LLVM-NEXT:   Offset: 0x580
 # ELF-LLVM-NEXT:     VirtualAddress: 0x1000
 # ELF-LLVM-NEXT:     PhysicalAddress: 0x1000
 # ELF-LLVM-NEXT:     FileSize: 3
@@ -307,8 +322,8 @@
 # ELF-LLVM-NEXT:   }
 # ELF-LLVM-NEXT:   ProgramHeader {
 # ELF-LLVM-NEXT:     Type: PT_OPENBSD_WXNEEDED (0x65A3DBE7)
-# ELF32-LLVM-NEXT:   Offset: 0x314
-# ELF64-LLVM-NEXT:   Offset: 0x548
+# ELF32-LLVM-NEXT:   Offset: 0x334
+# ELF64-LLVM-NEXT:   Offset: 0x580
 # ELF-LLVM-NEXT:     VirtualAddress: 0x1000
 # ELF-LLVM-NEXT:     PhysicalAddress: 0x1000
 # ELF-LLVM-NEXT:     FileSize: 3
@@ -319,8 +334,8 @@
 # ELF-LLVM-NEXT:   }
 # ELF-LLVM-NEXT:   ProgramHeader {
 # ELF-LLVM-NEXT:     Type: PT_OPENBSD_BOOTDATA (0x65A41BE6)
-# ELF32-LLVM-NEXT:   Offset: 0x314
-# ELF64-LLVM-NEXT:   Offset: 0x548
+# ELF32-LLVM-NEXT:   Offset: 0x334
+# ELF64-LLVM-NEXT:   Offset: 0x580
 # ELF-LLVM-NEXT:     VirtualAddress: 0x1000
 # ELF-LLVM-NEXT:     PhysicalAddress: 0x1000
 # ELF-LLVM-NEXT:     FileSize: 3
@@ -331,8 +346,8 @@
 # ELF-LLVM-NEXT:   }
 # ELF-LLVM-NEXT:   ProgramHeader {
 # ELF-LLVM-NEXT:     Type: Unknown (0x6FFFFFFF)
-# ELF32-LLVM-NEXT:   Offset: 0x314
-# ELF64-LLVM-NEXT:   Offset: 0x548
+# ELF32-LLVM-NEXT:   Offset: 0x334
+# ELF64-LLVM-NEXT:   Offset: 0x580
 # ELF-LLVM-NEXT:     VirtualAddress: 0x1000
 # ELF-LLVM-NEXT:     PhysicalAddress: 0x1000
 # ELF-LLVM-NEXT:     FileSize: 3
@@ -343,8 +358,8 @@
 # ELF-LLVM-NEXT:   }
 # ELF-LLVM-NEXT:   ProgramHeader {
 # ELF-LLVM-NEXT:     Type: Unknown (0x70000000)
-# ELF32-LLVM-NEXT:   Offset: 0x314
-# ELF64-LLVM-NEXT:   Offset: 0x548
+# ELF32-LLVM-NEXT:   Offset: 0x334
+# ELF64-LLVM-NEXT:   Offset: 0x580
 # ELF-LLVM-NEXT:     VirtualAddress: 0x1000
 # ELF-LLVM-NEXT:     PhysicalAddress: 0x1000
 # ELF-LLVM-NEXT:     FileSize: 3
@@ -355,8 +370,8 @@
 # ELF-LLVM-NEXT:   }
 # ELF-LLVM-NEXT:   ProgramHeader {
 # ELF-LLVM-NEXT:     Type: Unknown (0x70000001)
-# ELF32-LLVM-NEXT:   Offset: 0x314
-# ELF64-LLVM-NEXT:   Offset: 0x548
+# ELF32-LLVM-NEXT:   Offset: 0x334
+# ELF64-LLVM-NEXT:   Offset: 0x580
 # ELF-LLVM-NEXT:     VirtualAddress: 0x1000
 # ELF-LLVM-NEXT:     PhysicalAddress: 0x1000
 # ELF-LLVM-NEXT:     FileSize: 3
@@ -367,8 +382,8 @@
 # ELF-LLVM-NEXT:   }
 # ELF-LLVM-NEXT:   ProgramHeader {
 # ELF-LLVM-NEXT:     Type: Unknown (0x70000002)
-# ELF32-LLVM-NEXT:   Offset: 0x314
-# ELF64-LLVM-NEXT:   Offset: 0x548
+# ELF32-LLVM-NEXT:   Offset: 0x334
+# ELF64-LLVM-NEXT:   Offset: 0x580
 # ELF-LLVM-NEXT:     VirtualAddress: 0x1000
 # ELF-LLVM-NEXT:     PhysicalAddress: 0x1000
 # ELF-LLVM-NEXT:     FileSize: 3
@@ -379,8 +394,8 @@
 # ELF-LLVM-NEXT:   }
 # ELF-LLVM-NEXT:   ProgramHeader {
 # ELF-LLVM-NEXT:     Type: Unknown (0x70000003)
-# ELF32-LLVM-NEXT:   Offset: 0x314
-# ELF64-LLVM-NEXT:   Offset: 0x548
+# ELF32-LLVM-NEXT:   Offset: 0x334
+# ELF64-LLVM-NEXT:   Offset: 0x580
 # ELF-LLVM-NEXT:     VirtualAddress: 0x1000
 # ELF-LLVM-NEXT:     PhysicalAddress: 0x1000
 # ELF-LLVM-NEXT:     FileSize: 3
@@ -391,8 +406,8 @@
 # ELF-LLVM-NEXT:   }
 # ELF-LLVM-NEXT:   ProgramHeader {
 # ELF-LLVM-NEXT:     Type: Unknown (0x7FFFFFFF)
-# ELF32-LLVM-NEXT:   Offset: 0x314
-# ELF64-LLVM-NEXT:   Offset: 0x548
+# ELF32-LLVM-NEXT:   Offset: 0x334
+# ELF64-LLVM-NEXT:   Offset: 0x580
 # ELF-LLVM-NEXT:     VirtualAddress: 0x1000
 # ELF-LLVM-NEXT:     PhysicalAddress: 0x1000
 # ELF-LLVM-NEXT:     FileSize: 3
@@ -519,47 +534,52 @@ ProgramHeaders:
     VAddr:    0x1000
     FirstSec: .foo.begin
     LastSec:  .foo.end
-## Case 15: the PT_OPENBSD_RANDOMIZE segment.
+## Case 15: the PT_OPENBSD_MUTABLE segment.
+  - Type:     0x65a3dbe5 ## PT_OPENBSD_MUTABLE
+    VAddr:    0x1000
+    FirstSec: .foo.begin
+    LastSec:  .foo.end
+## Case 16: the PT_OPENBSD_RANDOMIZE segment.
   - Type:     0x65a3dbe6 ## PT_OPENBSD_RANDOMIZE
     VAddr:    0x1000
     FirstSec: .foo.begin
     LastSec:  .foo.end
-## Case 16: the PT_OPENBSD_WXNEEDED segment.
+## Case 17: the PT_OPENBSD_WXNEEDED segment.
   - Type:     0x65a3dbe7 ## PT_OPENBSD_WXNEEDED
     VAddr:    0x1000
     FirstSec: .foo.begin
     LastSec:  .foo.end
-## Case 17: the PT_OPENBSD_BOOTDATA segment.
+## Case 18: the PT_OPENBSD_BOOTDATA segment.
   - Type:     0x65a41be6 ## PT_OPENBSD_BOOTDATA
     VAddr:    0x1000
     FirstSec: .foo.begin
     LastSec:  .foo.end
-## Case 18: the PT_HIOS segment.
+## Case 19: the PT_HIOS segment.
   - Type:     0x6fffffff ## PT_HIOS
     VAddr:    0x1000
     FirstSec: .foo.begin
     LastSec:  .foo.end
-## Case 19: the PT_LOPROC/PT_ARM_ARCHEXT/PT_MIPS_REGINFO segment.
+## Case 20: the PT_LOPROC/PT_ARM_ARCHEXT/PT_MIPS_REGINFO segment.
   - Type:     0x70000000 ## PT_LOPROC/PT_ARM_ARCHEXT/PT_MIPS_REGINFO
     VAddr:    0x1000
     FirstSec: .foo.begin
     LastSec:  .foo.end
-## Case 20: the PT_ARM_EXIDX/PT_MIPS_RTPROC segment.
+## Case 22: the PT_ARM_EXIDX/PT_MIPS_RTPROC segment.
   - Type:     0x70000001 ## PT_ARM_EXIDX, PT_MIPS_RTPROC
     VAddr:    0x1000
     FirstSec: .foo.begin
     LastSec:  .foo.end
-## Case 20: the PT_MIPS_OPTIONS segment.
+## Case 21: the PT_MIPS_OPTIONS segment.
   - Type:     0x70000002 ## PT_MIPS_OPTIONS
     VAddr:    0x1000
     FirstSec: .foo.begin
     LastSec:  .foo.end
-## Case 21: the PT_MIPS_ABIFLAGS/PT_RISCV_ATTRIBUTES segment.
+## Case 22: the PT_MIPS_ABIFLAGS/PT_RISCV_ATTRIBUTES segment.
   - Type:     0x70000003 ## PT_MIPS_ABIFLAGS/PT_RISCV_ATTRIBUTES
     VAddr:    0x1000
     FirstSec: .foo.begin
     LastSec:  .foo.end
-## Case 22: the PT_HIPROC segment.
+## Case 23: the PT_HIPROC segment.
   - Type:     0x7fffffff ## PT_HIPROC
     VAddr:    0x1000
     FirstSec: .foo.begin
@@ -570,9 +590,9 @@ ProgramHeaders:
 # RUN: llvm-readelf --program-headers %tarm.elf | FileCheck %s --check-prefix=ARM-GNU
 # RUN: llvm-readobj --program-headers %tarm.elf | FileCheck %s --check-prefix=ARM-LLVM
 
-# ARM-GNU:      <unknown>: 0x70000000 0x000548 0x0000000000001000 0x0000000000001000 0x000003 0x000003 0x1
-# ARM-GNU-NEXT:            EXIDX      0x000548 0x0000000000001000 0x0000000000001000 0x000003 0x000003 0x1
-# ARM-GNU-NEXT: <unknown>: 0x70000002 0x000548 0x0000000000001000 0x0000000000001000 0x000003 0x000003 0x1
+# ARM-GNU:      <unknown>: 0x70000000 0x000580 0x0000000000001000 0x0000000000001000 0x000003 0x000003 0x1
+# ARM-GNU-NEXT:            EXIDX      0x000580 0x0000000000001000 0x0000000000001000 0x000003 0x000003 0x1
+# ARM-GNU-NEXT: <unknown>: 0x70000002 0x000580 0x0000000000001000 0x0000000000001000 0x000003 0x000003 0x1
 
 # ARM-LLVM:      ProgramHeader {
 # ARM-LLVM:        Type: Unknown (0x70000000)
@@ -586,10 +606,10 @@ ProgramHeaders:
 # RUN: llvm-readelf --program-headers %tmips.elf | FileCheck %s --check-prefix=MIPS-GNU
 # RUN: llvm-readobj --program-headers %tmips.elf | FileCheck %s --check-prefix=MIPS-LLVM
 
-# MIPS-GNU:      REGINFO  0x000548 0x0000000000001000 0x0000000000001000 0x000003 0x000003 0x1
-# MIPS-GNU-NEXT: RTPROC   0x000548 0x0000000000001000 0x0000000000001000 0x000003 0x000003 0x1
-# MIPS-GNU-NEXT: OPTIONS  0x000548 0x0000000000001000 0x0000000000001000 0x000003 0x000003 0x1
-# MIPS-GNU-NEXT: ABIFLAGS 0x000548 0x0000000000001000 0x0000000000001000 0x000003 0x000003 0x1
+# MIPS-GNU:      REGINFO  0x000580 0x0000000000001000 0x0000000000001000 0x000003 0x000003 0x1
+# MIPS-GNU-NEXT: RTPROC   0x000580 0x0000000000001000 0x0000000000001000 0x000003 0x000003 0x1
+# MIPS-GNU-NEXT: OPTIONS  0x000580 0x0000000000001000 0x0000000000001000 0x000003 0x000003 0x1
+# MIPS-GNU-NEXT: ABIFLAGS 0x000580 0x0000000000001000 0x0000000000001000 0x000003 0x000003 0x1
 
 # MIPS-LLVM:      ProgramHeader {
 # MIPS-LLVM:        Type: PT_MIPS_REGINFO (0x70000000)
@@ -605,7 +625,7 @@ ProgramHeaders:
 # RUN: llvm-readelf --program-headers %triscv.elf | FileCheck %s --check-prefix=RISCV-GNU
 # RUN: llvm-readobj --program-headers %triscv.elf | FileCheck %s --check-prefix=RISCV-LLVM
 
-# RISCV-GNU:       ATTRIBUTES  0x000548 0x0000000000001000 0x0000000000001000 0x000003 0x000003 0x1
+# RISCV-GNU:       ATTRIBUTES  0x000580 0x0000000000001000 0x0000000000001000 0x000003 0x000003 0x1
 # RISCV-LLVM:      ProgramHeader {
 # RISCV-LLVM:        Type: PT_RISCV_ATTRIBUTES (0x70000003)
 

diff  --git a/llvm/tools/llvm-objdump/ELFDump.cpp b/llvm/tools/llvm-objdump/ELFDump.cpp
index 61676b4323d2f..b7ce08613c9b8 100644
--- a/llvm/tools/llvm-objdump/ELFDump.cpp
+++ b/llvm/tools/llvm-objdump/ELFDump.cpp
@@ -250,6 +250,9 @@ static void printProgramHeaders(const ELFFile<ELFT> &Obj, StringRef FileName) {
     case ELF::PT_OPENBSD_BOOTDATA:
       outs() << "    OPENBSD_BOOTDATA ";
       break;
+    case ELF::PT_OPENBSD_MUTABLE:
+      outs() << "    OPENBSD_MUTABLE ";
+      break;
     case ELF::PT_OPENBSD_RANDOMIZE:
       outs() << "    OPENBSD_RANDOMIZE ";
       break;

diff  --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp
index 36f1fbe60d33c..0ff06777e712d 100644
--- a/llvm/tools/llvm-readobj/ELFDumper.cpp
+++ b/llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -1411,6 +1411,7 @@ static StringRef segmentTypeToString(unsigned Arch, unsigned Type) {
     LLVM_READOBJ_ENUM_CASE(ELF, PT_GNU_RELRO);
     LLVM_READOBJ_ENUM_CASE(ELF, PT_GNU_PROPERTY);
 
+    LLVM_READOBJ_ENUM_CASE(ELF, PT_OPENBSD_MUTABLE);
     LLVM_READOBJ_ENUM_CASE(ELF, PT_OPENBSD_RANDOMIZE);
     LLVM_READOBJ_ENUM_CASE(ELF, PT_OPENBSD_WXNEEDED);
     LLVM_READOBJ_ENUM_CASE(ELF, PT_OPENBSD_BOOTDATA);


        


More information about the llvm-commits mailing list