[llvm] r353991 - [llvm-readobj] Dump GNU_PROPERTY_X86_ISA_1_{NEEDED, USED} notes in .note.gnu.property
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 13 15:18:05 PST 2019
Author: maskray
Date: Wed Feb 13 15:18:05 2019
New Revision: 353991
URL: http://llvm.org/viewvc/llvm-project?rev=353991&view=rev
Log:
[llvm-readobj] Dump GNU_PROPERTY_X86_ISA_1_{NEEDED,USED} notes in .note.gnu.property
Reviewers: grimar, rupprecht
Reviewed By: rupprecht
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58175
Modified:
llvm/trunk/include/llvm/BinaryFormat/ELF.h
llvm/trunk/test/tools/llvm-readobj/note-gnu-property.s
llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
Modified: llvm/trunk/include/llvm/BinaryFormat/ELF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/ELF.h?rev=353991&r1=353990&r2=353991&view=diff
==============================================================================
--- llvm/trunk/include/llvm/BinaryFormat/ELF.h (original)
+++ llvm/trunk/include/llvm/BinaryFormat/ELF.h Wed Feb 13 15:18:05 2019
@@ -1352,7 +1352,9 @@ enum : unsigned {
GNU_PROPERTY_STACK_SIZE = 1,
GNU_PROPERTY_NO_COPY_ON_PROTECTED = 2,
GNU_PROPERTY_X86_FEATURE_1_AND = 0xc0000002,
+ GNU_PROPERTY_X86_ISA_1_NEEDED = 0xc0008000,
GNU_PROPERTY_X86_FEATURE_2_NEEDED = 0xc0008001,
+ GNU_PROPERTY_X86_ISA_1_USED = 0xc0010000,
GNU_PROPERTY_X86_FEATURE_2_USED = 0xc0010001,
};
@@ -1361,6 +1363,31 @@ enum : unsigned {
GNU_PROPERTY_X86_FEATURE_1_IBT = 1 << 0,
GNU_PROPERTY_X86_FEATURE_1_SHSTK = 1 << 1,
+ GNU_PROPERTY_X86_ISA_1_CMOV = 1 << 0,
+ GNU_PROPERTY_X86_ISA_1_SSE = 1 << 1,
+ GNU_PROPERTY_X86_ISA_1_SSE2 = 1 << 2,
+ GNU_PROPERTY_X86_ISA_1_SSE3 = 1 << 3,
+ GNU_PROPERTY_X86_ISA_1_SSSE3 = 1 << 4,
+ GNU_PROPERTY_X86_ISA_1_SSE4_1 = 1 << 5,
+ GNU_PROPERTY_X86_ISA_1_SSE4_2 = 1 << 6,
+ GNU_PROPERTY_X86_ISA_1_AVX = 1 << 7,
+ GNU_PROPERTY_X86_ISA_1_AVX2 = 1 << 8,
+ GNU_PROPERTY_X86_ISA_1_FMA = 1 << 9,
+ GNU_PROPERTY_X86_ISA_1_AVX512F = 1 << 10,
+ GNU_PROPERTY_X86_ISA_1_AVX512CD = 1 << 11,
+ GNU_PROPERTY_X86_ISA_1_AVX512ER = 1 << 12,
+ GNU_PROPERTY_X86_ISA_1_AVX512PF = 1 << 13,
+ GNU_PROPERTY_X86_ISA_1_AVX512VL = 1 << 14,
+ GNU_PROPERTY_X86_ISA_1_AVX512DQ = 1 << 15,
+ GNU_PROPERTY_X86_ISA_1_AVX512BW = 1 << 16,
+ GNU_PROPERTY_X86_ISA_1_AVX512_4FMAPS = 1 << 17,
+ GNU_PROPERTY_X86_ISA_1_AVX512_4VNNIW = 1 << 18,
+ GNU_PROPERTY_X86_ISA_1_AVX512_BITALG = 1 << 19,
+ GNU_PROPERTY_X86_ISA_1_AVX512_IFMA = 1 << 20,
+ GNU_PROPERTY_X86_ISA_1_AVX512_VBMI = 1 << 21,
+ GNU_PROPERTY_X86_ISA_1_AVX512_VBMI2 = 1 << 22,
+ GNU_PROPERTY_X86_ISA_1_AVX512_VNNI = 1 << 23,
+
GNU_PROPERTY_X86_FEATURE_2_X86 = 1 << 0,
GNU_PROPERTY_X86_FEATURE_2_X87 = 1 << 1,
GNU_PROPERTY_X86_FEATURE_2_MMX = 1 << 2,
Modified: llvm/trunk/test/tools/llvm-readobj/note-gnu-property.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/note-gnu-property.s?rev=353991&r1=353990&r2=353991&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/note-gnu-property.s (original)
+++ llvm/trunk/test/tools/llvm-readobj/note-gnu-property.s Wed Feb 13 15:18:05 2019
@@ -3,15 +3,17 @@
// RUN: llvm-readobj -elf-output-style GNU --notes %t | FileCheck %s --check-prefix=GNU
// RUN: llvm-readobj -elf-output-style LLVM --notes %t | FileCheck %s --check-prefix=LLVM
-// GNU: Displaying notes found at file offset 0x00000040 with length 0x000000d8:
+// GNU: Displaying notes found at file offset 0x00000040 with length 0x000000f8:
// GNU-NEXT: Owner Data size Description
-// GNU-NEXT: GNU 0x000000c8 NT_GNU_PROPERTY_TYPE_0 (property note)
+// GNU-NEXT: GNU 0x000000e8 NT_GNU_PROPERTY_TYPE_0 (property note)
// GNU-NEXT: Properties: stack size: 0x100
// GNU-NEXT: stack size: 0x100
// GNU-NEXT: no copy on protected
// GNU-NEXT: x86 feature: SHSTK
// GNU-NEXT: x86 feature: IBT, SHSTK
// GNU-NEXT: x86 feature: <None>
+// GNU-NEXT: x86 ISA needed: CMOV, SSE, SSE2, SSE3, SSSE3, SSE4_1, SSE4_2, AVX, AVX2, FMA, AVX512F, AVX512CD
+// GNU-NEXT: x86 ISA used: AVX512ER, AVX512PF, AVX512VL, AVX512DQ, AVX512BW, AVX512_4FMAPS, AVX512_4VNNIW, AVX512_BITALG, AVX512_IFMA, AVX512_VBMI, AVX512_VBMI2, AVX512_VNNI
// GNU-NEXT: x86 feature needed: x86, x87
// GNU-NEXT: x86 feature used: XSAVEOPT, XSAVEC
// GNU-NEXT: <application-specific type 0xfefefefe>
@@ -25,10 +27,10 @@
// LLVM: Notes [
// LLVM-NEXT: NoteSection {
// LLVM-NEXT: Offset: 0x40
-// LLVM-NEXT: Size: 0xD8
+// LLVM-NEXT: Size: 0xF8
// LLVM-NEXT: Note {
// LLVM-NEXT: Owner: GNU
-// LLVM-NEXT: Data size: 0xC8
+// LLVM-NEXT: Data size: 0xE8
// LLVM-NEXT: Type: NT_GNU_PROPERTY_TYPE_0 (property note)
// LLVM-NEXT: Property [
// LLVM-NEXT: stack size: 0x100
@@ -37,6 +39,8 @@
// LLVM-NEXT: x86 feature: SHSTK
// LLVM-NEXT: x86 feature: IBT, SHSTK
// LLVM-NEXT: x86 feature: <None>
+// LLVM-NEXT: x86 ISA needed: CMOV, SSE, SSE2, SSE3, SSSE3, SSE4_1, SSE4_2, AVX, AVX2, FMA, AVX512F, AVX512CD
+// LLVM-NEXT: x86 ISA used: AVX512ER, AVX512PF, AVX512VL, AVX512DQ, AVX512BW, AVX512_4FMAPS, AVX512_4VNNIW, AVX512_BITALG, AVX512_IFMA, AVX512_VBMI, AVX512_VBMI2, AVX512_VNNI
// LLVM-NEXT: x86 feature needed: x86, x87
// LLVM-NEXT: x86 feature used: XSAVEOPT, XSAVEC
// LLVM-NEXT: <application-specific type 0xfefefefe>
@@ -91,6 +95,16 @@ begin:
.long 0 /* Empty flags, not an error */
.p2align 3 /* Align to 8 byte for 64 bit */
+ .long 0xc0008000 /* Type: GNU_PROPERTY_X86_ISA_1_NEEDED */
+ .long 4 /* Data size */
+ .long 0x00000fff /* CMOV, ... */
+ .p2align 3 /* Align to 8 byte for 64 bit */
+
+ .long 0xc0010000 /* Type: GNU_PROPERTY_X86_ISA_1_USED */
+ .long 4 /* Data size */
+ .long 0x00fff000 /* AVX512_ER, ... */
+ .p2align 3 /* Align to 8 byte for 64 bit */
+
.long 0xc0008001 /* Type: GNU_PROPERTY_X86_FEATURE_2_NEEDED */
.long 4 /* Data size */
.long 0x00000003 /* X86 X87 */
Modified: llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ELFDumper.cpp?rev=353991&r1=353990&r2=353991&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/ELFDumper.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/ELFDumper.cpp Wed Feb 13 15:18:05 2019
@@ -3694,6 +3694,47 @@ static std::string getGNUProperty(uint32
if (PrData)
OS << format("<unknown flags: 0x%x>", PrData);
return OS.str();
+ case GNU_PROPERTY_X86_ISA_1_NEEDED:
+ case GNU_PROPERTY_X86_ISA_1_USED:
+ OS << "x86 ISA "
+ << (Type == GNU_PROPERTY_X86_ISA_1_NEEDED ? "needed: " : "used: ");
+ if (DataSize != 4) {
+ OS << format("<corrupt length: 0x%x>", DataSize);
+ return OS.str();
+ }
+ PrData = support::endian::read32<ELFT::TargetEndianness>(Data.data());
+ if (PrData == 0) {
+ OS << "<None>";
+ return OS.str();
+ }
+ DumpBit(GNU_PROPERTY_X86_ISA_1_CMOV, "CMOV");
+ DumpBit(GNU_PROPERTY_X86_ISA_1_SSE, "SSE");
+ DumpBit(GNU_PROPERTY_X86_ISA_1_SSE2, "SSE2");
+ DumpBit(GNU_PROPERTY_X86_ISA_1_SSE3, "SSE3");
+ DumpBit(GNU_PROPERTY_X86_ISA_1_SSSE3, "SSSE3");
+ DumpBit(GNU_PROPERTY_X86_ISA_1_SSE4_1, "SSE4_1");
+ DumpBit(GNU_PROPERTY_X86_ISA_1_SSE4_2, "SSE4_2");
+ DumpBit(GNU_PROPERTY_X86_ISA_1_AVX, "AVX");
+ DumpBit(GNU_PROPERTY_X86_ISA_1_AVX2, "AVX2");
+ DumpBit(GNU_PROPERTY_X86_ISA_1_FMA, "FMA");
+ DumpBit(GNU_PROPERTY_X86_ISA_1_AVX512F, "AVX512F");
+ DumpBit(GNU_PROPERTY_X86_ISA_1_AVX512CD, "AVX512CD");
+ DumpBit(GNU_PROPERTY_X86_ISA_1_AVX512ER, "AVX512ER");
+ DumpBit(GNU_PROPERTY_X86_ISA_1_AVX512PF, "AVX512PF");
+ DumpBit(GNU_PROPERTY_X86_ISA_1_AVX512VL, "AVX512VL");
+ DumpBit(GNU_PROPERTY_X86_ISA_1_AVX512DQ, "AVX512DQ");
+ DumpBit(GNU_PROPERTY_X86_ISA_1_AVX512BW, "AVX512BW");
+ DumpBit(GNU_PROPERTY_X86_ISA_1_AVX512_4FMAPS, "AVX512_4FMAPS");
+ DumpBit(GNU_PROPERTY_X86_ISA_1_AVX512_4VNNIW, "AVX512_4VNNIW");
+ DumpBit(GNU_PROPERTY_X86_ISA_1_AVX512_BITALG, "AVX512_BITALG");
+ DumpBit(GNU_PROPERTY_X86_ISA_1_AVX512_IFMA, "AVX512_IFMA");
+ DumpBit(GNU_PROPERTY_X86_ISA_1_AVX512_VBMI, "AVX512_VBMI");
+ DumpBit(GNU_PROPERTY_X86_ISA_1_AVX512_VBMI2, "AVX512_VBMI2");
+ DumpBit(GNU_PROPERTY_X86_ISA_1_AVX512_VNNI, "AVX512_VNNI");
+ if (PrData)
+ OS << format("<unknown flags: 0x%x>", PrData);
+ return OS.str();
+ break;
case GNU_PROPERTY_X86_FEATURE_2_NEEDED:
case GNU_PROPERTY_X86_FEATURE_2_USED:
OS << "x86 feature "
More information about the llvm-commits
mailing list