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: 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(" ", 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("", DataSize); return OS.str(); @@ -3851,8 +3853,13 @@ OS << ""; 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("", PrData); return OS.str();