[PATCH] D62595: [AARCH64][ELF][llvm-readobj] Support for AArch64 .note.gnu.property
Peter Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 4 04:25:22 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL362490: [AARCH64][ELF][llvm-readobj] Support for AArch64 .note.gnu.property (authored by psmith, committed by ).
Herald added a project: LLVM.
Changed prior to commit:
https://reviews.llvm.org/D62595?vs=202145&id=202905#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D62595/new/
https://reviews.llvm.org/D62595
Files:
llvm/trunk/include/llvm/BinaryFormat/ELF.h
llvm/trunk/test/tools/llvm-readobj/AArch64/aarch64-note-gnu-property.s
llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
Index: llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
===================================================================
--- llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
+++ llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
@@ -3840,8 +3840,10 @@
if (DataSize)
OS << format(" <corrupt length: 0x%x>", DataSize);
return OS.str();
+ case GNU_PROPERTY_AARCH64_FEATURE_1_AND:
case GNU_PROPERTY_X86_FEATURE_1_AND:
- OS << "x86 feature: ";
+ OS << ((Type == GNU_PROPERTY_AARCH64_FEATURE_1_AND) ? "aarch64 feature: "
+ : "x86 feature: ");
if (DataSize != 4) {
OS << format("<corrupt length: 0x%x>", DataSize);
return OS.str();
@@ -3851,8 +3853,13 @@
OS << "<None>";
return OS.str();
}
- DumpBit(GNU_PROPERTY_X86_FEATURE_1_IBT, "IBT");
- DumpBit(GNU_PROPERTY_X86_FEATURE_1_SHSTK, "SHSTK");
+ if (Type == GNU_PROPERTY_AARCH64_FEATURE_1_AND) {
+ DumpBit(GNU_PROPERTY_AARCH64_FEATURE_1_BTI, "BTI");
+ DumpBit(GNU_PROPERTY_AARCH64_FEATURE_1_PAC, "PAC");
+ } else {
+ DumpBit(GNU_PROPERTY_X86_FEATURE_1_IBT, "IBT");
+ DumpBit(GNU_PROPERTY_X86_FEATURE_1_SHSTK, "SHSTK");
+ }
if (PrData)
OS << format("<unknown flags: 0x%x>", PrData);
return OS.str();
Index: llvm/trunk/include/llvm/BinaryFormat/ELF.h
===================================================================
--- llvm/trunk/include/llvm/BinaryFormat/ELF.h
+++ llvm/trunk/include/llvm/BinaryFormat/ELF.h
@@ -1364,6 +1364,7 @@
enum : unsigned {
GNU_PROPERTY_STACK_SIZE = 1,
GNU_PROPERTY_NO_COPY_ON_PROTECTED = 2,
+ GNU_PROPERTY_AARCH64_FEATURE_1_AND = 0xc0000000,
GNU_PROPERTY_X86_FEATURE_1_AND = 0xc0000002,
GNU_PROPERTY_X86_ISA_1_NEEDED = 0xc0008000,
GNU_PROPERTY_X86_FEATURE_2_NEEDED = 0xc0008001,
@@ -1371,6 +1372,12 @@
GNU_PROPERTY_X86_FEATURE_2_USED = 0xc0010001,
};
+// aarch64 processor feature bits.
+enum : unsigned {
+ GNU_PROPERTY_AARCH64_FEATURE_1_BTI = 1 << 0,
+ GNU_PROPERTY_AARCH64_FEATURE_1_PAC = 1 << 1,
+};
+
// x86 processor feature bits.
enum : unsigned {
GNU_PROPERTY_X86_FEATURE_1_IBT = 1 << 0,
Index: llvm/trunk/test/tools/llvm-readobj/AArch64/aarch64-note-gnu-property.s
===================================================================
--- llvm/trunk/test/tools/llvm-readobj/AArch64/aarch64-note-gnu-property.s
+++ llvm/trunk/test/tools/llvm-readobj/AArch64/aarch64-note-gnu-property.s
@@ -0,0 +1,38 @@
+// RUN: llvm-mc -filetype=obj -triple aarch64-linux-gnu %s -o %t
+// RUN: llvm-readelf --notes %t | FileCheck %s --check-prefix=GNU
+// RUN: llvm-readobj --notes %t | FileCheck %s --check-prefix=LLVM
+
+// GNU: Displaying notes found at file offset 0x00000040 with length 0x00000020:
+// GNU-NEXT: Owner Data size Description
+// GNU-NEXT: GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 (property note)
+// GNU-NEXT: Properties: aarch64 feature: BTI, PAC
+
+// LLVM: Notes [
+// LLVM-NEXT: NoteSection {
+// LLVM-NEXT: Offset: 0x40
+// LLVM-NEXT: Size: 0x20
+// LLVM-NEXT: Note {
+// LLVM-NEXT: Owner: GNU
+// LLVM-NEXT: Data size: 0x10
+// LLVM-NEXT: Type: NT_GNU_PROPERTY_TYPE_0 (property note)
+// LLVM-NEXT: Property [
+// LLVM-NEXT: aarch64 feature: BTI, PAC
+// LLVM-NEXT: ]
+// LLVM-NEXT: }
+// LLVM-NEXT: }
+// LLVM-NEXT: ]
+
+.section ".note.gnu.property", "a"
+.align 4
+ .long 4 /* Name length is always 4 ("GNU") */
+ .long end - begin /* Data length */
+ .long 5 /* Type: NT_GNU_PROPERTY_TYPE_0 */
+ .asciz "GNU" /* Name */
+ .p2align 3
+begin:
+ /* BTI and PAC property note */
+ .long 0xc0000000 /* Type: GNU_PROPERTY_AARCH64_FEATURE_1_AND */
+ .long 4 /* Data size */
+ .long 3 /* BTI and PAC */
+ .p2align 3 /* Align to 8 byte for 64 bit */
+end:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62595.202905.patch
Type: text/x-patch
Size: 3895 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190604/2a929aec/attachment.bin>
More information about the llvm-commits
mailing list