[llvm] c66b82f - [llvm-readelf] - Start recognizing 'PT_OPENBSD_*' segment types.
Georgii Rymar via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 21 03:13:50 PDT 2020
Author: Georgii Rymar
Date: 2020-08-21T13:13:05+03:00
New Revision: c66b82f14cc70ec063afa443525051c94621839b
URL: https://github.com/llvm/llvm-project/commit/c66b82f14cc70ec063afa443525051c94621839b
DIFF: https://github.com/llvm/llvm-project/commit/c66b82f14cc70ec063afa443525051c94621839b.diff
LOG: [llvm-readelf] - Start recognizing 'PT_OPENBSD_*' segment types.
Its a follow-up for D85830, it stops ignoring 'PT_OPENBSD_*' segment types.
Now them are recognized properly.
Note: GNU readelf does not recognize them, though perhaps it shouldn't.
Anyways, it was reported to binutils: https://sourceware.org/bugzilla/show_bug.cgi?id=26405#c0
Differential revision: https://reviews.llvm.org/D86208
Added:
Modified:
llvm/test/tools/llvm-readobj/ELF/program-headers.test
llvm/tools/llvm-readobj/ELFDumper.cpp
Removed:
################################################################################
diff --git a/llvm/test/tools/llvm-readobj/ELF/program-headers.test b/llvm/test/tools/llvm-readobj/ELF/program-headers.test
index d829f4c67418..74623b67edad 100644
--- a/llvm/test/tools/llvm-readobj/ELF/program-headers.test
+++ b/llvm/test/tools/llvm-readobj/ELF/program-headers.test
@@ -48,9 +48,9 @@
# 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: <unknown>: 0x65a3dbe6 0x000314 0x00001000 0x00001000 0x00003 0x00003 0x1
-# ELF32-NEXT: <unknown>: 0x65a3dbe7 0x000314 0x00001000 0x00001000 0x00003 0x00003 0x1
-# ELF32-NEXT: <unknown>: 0x65a41be6 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
@@ -78,9 +78,9 @@
# 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: <unknown>: 0x65a3dbe6 0x000548 0x0000000000001000 0x0000000000001000 0x000003 0x000003 0x1
-# ELF64-NEXT: <unknown>: 0x65a3dbe7 0x000548 0x0000000000001000 0x0000000000001000 0x000003 0x000003 0x1
-# ELF64-NEXT: <unknown>: 0x65a41be6 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
diff --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp
index 50612e1eda56..c321f4585e47 100644
--- a/llvm/tools/llvm-readobj/ELFDumper.cpp
+++ b/llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -1696,8 +1696,7 @@ static StringRef segmentTypeToString(unsigned Arch, unsigned Type) {
static std::string getGNUPtType(unsigned Arch, unsigned Type) {
StringRef Seg = segmentTypeToString(Arch, Type);
- // GNU doesn't recognize PT_OPENBSD_*.
- if (Seg.empty() || Seg.startswith("PT_OPENBSD_"))
+ if (Seg.empty())
return std::string("<unknown>: ") + to_string(format_hex(Type, 1));
// E.g. "PT_ARM_EXIDX" -> "EXIDX".
More information about the llvm-commits
mailing list