1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

[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
This commit is contained in:
Fangrui Song 2021-03-19 14:35:22 -07:00
parent 36d2e0e3b3
commit e2c184371f
3 changed files with 47 additions and 84 deletions

View File

@ -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.

View File

@ -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,16 +96,6 @@ 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 0x0000001f /* X86, ... */
@ -116,6 +106,16 @@ begin:
.long 0x000003e0 /* ZMM, ... */
.p2align 3 /* Align to 8 byte for 64 bit */
.long 0xc0008002 /* Type: GNU_PROPERTY_X86_ISA_1_NEEDED */
.long 4 /* Data size */
.long 0x0000000f /* x86-64-baseline, ... */
.p2align 3 /* Align to 8 byte for 64 bit */
.long 0xc0010002 /* Type: GNU_PROPERTY_X86_ISA_1_USED */
.long 4 /* Data size */
.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. */
/* Broken note type */

View File

@ -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();
}
}