[llvm] 948be86 - [llvm-readobj] Remove legacy GNU_PROPERTY_X86_ISA_1_{NEEDED,USED} and dump new GNU_PROPERTY_X86_ISA_1_{NEEDED,USED}
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 19 14:35:27 PDT 2021
Author: Fangrui Song
Date: 2021-03-19T14:35:22-07:00
New Revision: 948be862d6dde3ae5ebf3983f78ec2eee5422ed1
URL: https://github.com/llvm/llvm-project/commit/948be862d6dde3ae5ebf3983f78ec2eee5422ed1
DIFF: https://github.com/llvm/llvm-project/commit/948be862d6dde3ae5ebf3983f78ec2eee5422ed1.diff
LOG: [llvm-readobj] Remove legacy GNU_PROPERTY_X86_ISA_1_{NEEDED,USED} and dump new GNU_PROPERTY_X86_ISA_1_{NEEDED,USED}
https://sourceware.org/bugzilla/show_bug.cgi?id=26703 deprecated the
previous GNU_PROPERTY_X86_ISA_1_{CMOV,SSE,*} values (renamed to `COMPAT`)
and added new values.
Since the legacy values are not used by compilers, having dumping support in
llvm-readobj is unnecessary. So just drop the legacy feature.
The new values are used by GCC 11
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97250) `-march=x86-64-v[234]` to
indicate the micro-architecture ISA levels.
Differential Revision: https://reviews.llvm.org/D98818
Added:
Modified:
llvm/include/llvm/BinaryFormat/ELF.h
llvm/test/tools/llvm-readobj/ELF/note-gnu-property.s
llvm/tools/llvm-readobj/ELFDumper.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/BinaryFormat/ELF.h b/llvm/include/llvm/BinaryFormat/ELF.h
index 30209a59ca89..e4144370ebf3 100644
--- a/llvm/include/llvm/BinaryFormat/ELF.h
+++ b/llvm/include/llvm/BinaryFormat/ELF.h
@@ -1470,10 +1470,14 @@ enum : unsigned {
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,
- GNU_PROPERTY_X86_ISA_1_USED = 0xc0010000,
- GNU_PROPERTY_X86_FEATURE_2_USED = 0xc0010001,
+
+ GNU_PROPERTY_X86_UINT32_OR_LO = 0xc0008000,
+ GNU_PROPERTY_X86_FEATURE_2_NEEDED = GNU_PROPERTY_X86_UINT32_OR_LO + 1,
+ GNU_PROPERTY_X86_ISA_1_NEEDED = GNU_PROPERTY_X86_UINT32_OR_LO + 2,
+
+ GNU_PROPERTY_X86_UINT32_OR_AND_LO = 0xc0010000,
+ GNU_PROPERTY_X86_FEATURE_2_USED = GNU_PROPERTY_X86_UINT32_OR_AND_LO + 1,
+ GNU_PROPERTY_X86_ISA_1_USED = GNU_PROPERTY_X86_UINT32_OR_AND_LO + 2,
};
// aarch64 processor feature bits.
@@ -1487,31 +1491,6 @@ 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,
@@ -1522,6 +1501,11 @@ enum : unsigned {
GNU_PROPERTY_X86_FEATURE_2_XSAVE = 1 << 7,
GNU_PROPERTY_X86_FEATURE_2_XSAVEOPT = 1 << 8,
GNU_PROPERTY_X86_FEATURE_2_XSAVEC = 1 << 9,
+
+ GNU_PROPERTY_X86_ISA_1_BASELINE = 1 << 0,
+ GNU_PROPERTY_X86_ISA_1_V2 = 1 << 1,
+ GNU_PROPERTY_X86_ISA_1_V3 = 1 << 2,
+ GNU_PROPERTY_X86_ISA_1_V4 = 1 << 3,
};
// FreeBSD note types.
diff --git a/llvm/test/tools/llvm-readobj/ELF/note-gnu-property.s b/llvm/test/tools/llvm-readobj/ELF/note-gnu-property.s
index 8c3a40ad2f69..2d0d00f60639 100644
--- a/llvm/test/tools/llvm-readobj/ELF/note-gnu-property.s
+++ b/llvm/test/tools/llvm-readobj/ELF/note-gnu-property.s
@@ -12,10 +12,10 @@
// 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, MMX, XMM, YMM
// GNU-NEXT: x86 feature used: ZMM, FXSR, XSAVE, XSAVEOPT, XSAVEC
+// GNU-NEXT: x86 ISA needed: x86-64-baseline, x86-64-v2, x86-64-v3, x86-64-v4
+// GNU-NEXT: x86 ISA used: x86-64-baseline, x86-64-v2, x86-64-v3, x86-64-v4
// GNU-NEXT: <application-specific type 0xfefefefe>
// GNU-NEXT: stack size: <corrupt length: 0x0>
// GNU-NEXT: stack size: <corrupt length: 0x4>
@@ -40,10 +40,10 @@
// 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, MMX, XMM, YMM
// LLVM-NEXT: x86 feature used: ZMM, FXSR, XSAVE, XSAVEOPT, XSAVEC
+// LLVM-NEXT: x86 ISA needed: x86-64-baseline, x86-64-v2, x86-64-v3, x86-64-v4
+// LLVM-NEXT: x86 ISA used: x86-64-baseline, x86-64-v2, x86-64-v3, x86-64-v4
// LLVM-NEXT: <application-specific type 0xfefefefe>
// LLVM-NEXT: stack size: <corrupt length: 0x0>
// LLVM-NEXT: stack size: <corrupt length: 0x4>
@@ -96,24 +96,24 @@ 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 0xc0008001 /* Type: GNU_PROPERTY_X86_FEATURE_2_NEEDED */
.long 4 /* Data size */
- .long 0x00000fff /* CMOV, ... */
+ .long 0x0000001f /* X86, ... */
.p2align 3 /* Align to 8 byte for 64 bit */
- .long 0xc0010000 /* Type: GNU_PROPERTY_X86_ISA_1_USED */
+ .long 0xc0010001 /* Type: GNU_PROPERTY_X86_FEATURE_2_USED */
.long 4 /* Data size */
- .long 0x00fff000 /* AVX512_ER, ... */
+ .long 0x000003e0 /* ZMM, ... */
.p2align 3 /* Align to 8 byte for 64 bit */
- .long 0xc0008001 /* Type: GNU_PROPERTY_X86_FEATURE_2_NEEDED */
+ .long 0xc0008002 /* Type: GNU_PROPERTY_X86_ISA_1_NEEDED */
.long 4 /* Data size */
- .long 0x0000001f /* X86, ... */
+ .long 0x0000000f /* x86-64-baseline, ... */
.p2align 3 /* Align to 8 byte for 64 bit */
- .long 0xc0010001 /* Type: GNU_PROPERTY_X86_FEATURE_2_USED */
+ .long 0xc0010002 /* Type: GNU_PROPERTY_X86_ISA_1_USED */
.long 4 /* Data size */
- .long 0x000003e0 /* ZMM, ... */
+ .long 0x0000000f /* x86-64-baseline, ... */
.p2align 3 /* Align to 8 byte for 64 bit */
/* All notes below are broken. Test we are able to report them. */
diff --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp
index 2535ae7830ae..c4938ad7b5f1 100644
--- a/llvm/tools/llvm-readobj/ELFDumper.cpp
+++ b/llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -4736,47 +4736,6 @@ static std::string getGNUProperty(uint32_t Type, uint32_t DataSize,
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 "
@@ -4803,6 +4762,26 @@ static std::string getGNUProperty(uint32_t Type, uint32_t DataSize,
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_BASELINE, "x86-64-baseline");
+ DumpBit(GNU_PROPERTY_X86_ISA_1_V2, "x86-64-v2");
+ DumpBit(GNU_PROPERTY_X86_ISA_1_V3, "x86-64-v3");
+ DumpBit(GNU_PROPERTY_X86_ISA_1_V4, "x86-64-v4");
+ if (PrData)
+ OS << format("<unknown flags: 0x%x>", PrData);
+ return OS.str();
}
}
More information about the llvm-commits
mailing list