[llvm] 6556628 - [llvm-objdump] Remove leading whitespace for PT_GNU_PROPERTY. (#121591)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 13 06:15:29 PST 2025


Author: Ryan Mansfield
Date: 2025-01-13T14:15:24Z
New Revision: 65566281edac2b5f75a99302e7200c957db90143

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

LOG: [llvm-objdump] Remove leading whitespace for PT_GNU_PROPERTY. (#121591)

This fixes the misaligned display of addresses for this p_type.

Previous:

```
   STACK off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**64
         filesz 0x0000000000000000 memsz 0x0000000000000000 flags rw-
   PROPERTY off    0x0000000000000358 vaddr 0x0000000000000358 paddr 0x0000000000000358 align 2**3
         filesz 0x0000000000000020 memsz 0x0000000000000020 flags r--
    NOTE off    0x0000000000000334 vaddr 0x0000000000000334 paddr 0x0000000000000334 align 2**2
         filesz 0x0000000000000020 memsz 0x0000000000000020 flags r--
```

After:


```
   STACK off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**64
         filesz 0x0000000000000000 memsz 0x0000000000000000 flags rw-
PROPERTY off    0x0000000000000358 vaddr 0x0000000000000358 paddr 0x0000000000000358 align 2**3
         filesz 0x0000000000000020 memsz 0x0000000000000020 flags r--
    NOTE off    0x0000000000000334 vaddr 0x0000000000000334 paddr 0x0000000000000334 align 2**2
         filesz 0x0000000000000020 memsz 0x0000000000000020 flags r--
```

Added: 
    

Modified: 
    llvm/test/tools/llvm-objdump/ELF/pt-gnu-property.test
    llvm/tools/llvm-objdump/ELFDump.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/test/tools/llvm-objdump/ELF/pt-gnu-property.test b/llvm/test/tools/llvm-objdump/ELF/pt-gnu-property.test
index 246337866a7774..27f1252b3d5d19 100644
--- a/llvm/test/tools/llvm-objdump/ELF/pt-gnu-property.test
+++ b/llvm/test/tools/llvm-objdump/ELF/pt-gnu-property.test
@@ -2,7 +2,7 @@
 # RUN: llvm-objdump -p %t | FileCheck %s
 
 # CHECK: Program Header:
-# CHECK-NEXT: {{ }}PROPERTY{{ }}
+# CHECK-NEXT: {{^}}PROPERTY{{ }}
 
 --- !ELF
 FileHeader:

diff  --git a/llvm/tools/llvm-objdump/ELFDump.cpp b/llvm/tools/llvm-objdump/ELFDump.cpp
index d78cf485587e1e..e9e5b059f1786e 100644
--- a/llvm/tools/llvm-objdump/ELFDump.cpp
+++ b/llvm/tools/llvm-objdump/ELFDump.cpp
@@ -269,7 +269,7 @@ template <class ELFT> void ELFDumper<ELFT>::printProgramHeaders() {
       outs() << "   RELRO ";
       break;
     case ELF::PT_GNU_PROPERTY:
-      outs() << "   PROPERTY ";
+      outs() << "PROPERTY ";
       break;
     case ELF::PT_GNU_STACK:
       outs() << "   STACK ";


        


More information about the llvm-commits mailing list