[llvm] 87b45f1 - [llvm-readobj] Print AMDGPU specific values in GNU mode (#75661)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 18 07:22:27 PST 2023
Author: Joseph Huber
Date: 2023-12-18T09:22:22-06:00
New Revision: 87b45f1ca6d4ff4cb322c14b6375b2ea0063f82a
URL: https://github.com/llvm/llvm-project/commit/87b45f1ca6d4ff4cb322c14b6375b2ea0063f82a
DIFF: https://github.com/llvm/llvm-project/commit/87b45f1ca6d4ff4cb322c14b6375b2ea0063f82a.diff
LOG: [llvm-readobj] Print AMDGPU specific values in GNU mode (#75661)
Summary:
Currently, we don't emit any of the AMDGPU specific flags and options
when printing in GNU-mode (the default). This patch adds extra code to
handle outputting these values to match the output from GNU's `readelf`
when used on an AMDGPU image.
Added:
Modified:
llvm/test/tools/llvm-readobj/ELF/file-header-os-abi.test
llvm/tools/llvm-readobj/ELFDumper.cpp
Removed:
################################################################################
diff --git a/llvm/test/tools/llvm-readobj/ELF/file-header-os-abi.test b/llvm/test/tools/llvm-readobj/ELF/file-header-os-abi.test
index 31675928a0d929..f815e78e0c540b 100644
--- a/llvm/test/tools/llvm-readobj/ELF/file-header-os-abi.test
+++ b/llvm/test/tools/llvm-readobj/ELF/file-header-os-abi.test
@@ -167,21 +167,21 @@ FileHeader:
# RUN: llvm-readelf --file-headers %t.osabi.amd.hsa | FileCheck %s --match-full-lines --check-prefix=OSABI-AMDHSA-GNU
# OSABI-AMDHSA-LLVM: OS/ABI: AMDGPU_HSA (0x40)
-# OSABI-AMDHSA-GNU: OS/ABI: 40
+# OSABI-AMDHSA-GNU: OS/ABI: AMDGPU - HSA
# RUN: yaml2obj %s -DOSABI=ELFOSABI_AMDGPU_PAL -DMACHINE=EM_AMDGPU -o %t.osabi.amd.pal
# RUN: llvm-readobj --file-headers %t.osabi.amd.pal | FileCheck %s --match-full-lines --check-prefix=OSABI-AMDPAL-LLVM
# RUN: llvm-readelf --file-headers %t.osabi.amd.pal | FileCheck %s --match-full-lines --check-prefix=OSABI-AMDPAL-GNU
# OSABI-AMDPAL-LLVM: OS/ABI: AMDGPU_PAL (0x41)
-# OSABI-AMDPAL-GNU: OS/ABI: 41
+# OSABI-AMDPAL-GNU: OS/ABI: AMDGPU - PAL
# RUN: yaml2obj %s -DOSABI=ELFOSABI_AMDGPU_MESA3D -DMACHINE=EM_AMDGPU -o %t.osabi.amd.mesa3d
# RUN: llvm-readobj --file-headers %t.osabi.amd.mesa3d | FileCheck %s --match-full-lines --check-prefix=OSABI-AMDMESA3D-LLVM
# RUN: llvm-readelf --file-headers %t.osabi.amd.mesa3d | FileCheck %s --match-full-lines --check-prefix=OSABI-AMDMESA3D-GNU
# OSABI-AMDMESA3D-LLVM: OS/ABI: AMDGPU_MESA3D (0x42)
-# OSABI-AMDMESA3D-GNU: OS/ABI: 42
+# OSABI-AMDMESA3D-GNU: OS/ABI: AMDGPU - MESA3D
# Check all EM_ARM specific values.
diff --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp
index f2851a52671bcb..abf7ba6ba1c387 100644
--- a/llvm/tools/llvm-readobj/ELFDumper.cpp
+++ b/llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -1558,139 +1558,139 @@ const EnumEntry<unsigned> ElfHeaderMipsFlags[] = {
};
const EnumEntry<unsigned> ElfHeaderAMDGPUFlagsABIVersion3[] = {
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_NONE),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_R600),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_R630),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_RS880),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_RV670),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_RV710),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_RV730),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_RV770),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_CEDAR),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_CYPRESS),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_JUNIPER),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_REDWOOD),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_SUMO),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_BARTS),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_CAICOS),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_CAYMAN),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_TURKS),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX600),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX601),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX602),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX700),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX701),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX702),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX703),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX704),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX705),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX801),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX802),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX803),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX805),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX810),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX900),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX902),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX904),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX906),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX908),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX909),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX90A),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX90C),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX940),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX941),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX942),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1010),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1011),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1012),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1013),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1030),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1031),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1032),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1033),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1034),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1035),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1036),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1100),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1101),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1102),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1103),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1150),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1151),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1200),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1201),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_FEATURE_XNACK_V3),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_FEATURE_SRAMECC_V3),
+ ENUM_ENT(EF_AMDGPU_MACH_NONE, "none"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_R600, "r600"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_R630, "r630"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_RS880, "rs880"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_RV670, "rv670"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_RV710, "rv710"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_RV730, "rv730"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_RV770, "rv770"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_CEDAR, "cedar"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_CYPRESS, "cypress"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_JUNIPER, "juniper"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_REDWOOD, "redwood"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_SUMO, "sumo"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_BARTS, "barts"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_CAICOS, "caicos"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_CAYMAN, "cayman"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_TURKS, "turks"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX600, "gfx600"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX601, "gfx601"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX602, "gfx602"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX700, "gfx700"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX701, "gfx701"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX702, "gfx702"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX703, "gfx703"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX704, "gfx704"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX705, "gfx705"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX801, "gfx801"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX802, "gfx802"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX803, "gfx803"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX805, "gfx805"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX810, "gfx810"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX900, "gfx900"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX902, "gfx902"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX904, "gfx904"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX906, "gfx906"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX908, "gfx908"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX909, "gfx909"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX90A, "gfx90a"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX90C, "gfx90c"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX940, "gfx940"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX941, "gfx941"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX942, "gfx942"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1010, "gfx1010"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1011, "gfx1011"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1012, "gfx1012"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1013, "gfx1013"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1030, "gfx1030"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1031, "gfx1031"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1032, "gfx1032"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1033, "gfx1033"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1034, "gfx1034"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1035, "gfx1035"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1036, "gfx1036"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1100, "gfx1100"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1101, "gfx1101"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1102, "gfx1102"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1103, "gfx1103"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1150, "gfx1150"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1151, "gfx1151"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1200, "gfx1200"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1201, "gfx1201"),
+ ENUM_ENT(EF_AMDGPU_FEATURE_XNACK_V3, "xnack"),
+ ENUM_ENT(EF_AMDGPU_FEATURE_SRAMECC_V3, "sramecc"),
};
const EnumEntry<unsigned> ElfHeaderAMDGPUFlagsABIVersion4[] = {
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_NONE),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_R600),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_R630),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_RS880),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_RV670),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_RV710),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_RV730),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_RV770),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_CEDAR),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_CYPRESS),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_JUNIPER),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_REDWOOD),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_SUMO),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_BARTS),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_CAICOS),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_CAYMAN),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_TURKS),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX600),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX601),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX602),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX700),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX701),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX702),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX703),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX704),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX705),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX801),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX802),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX803),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX805),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX810),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX900),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX902),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX904),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX906),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX908),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX909),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX90A),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX90C),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX940),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX941),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX942),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1010),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1011),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1012),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1013),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1030),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1031),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1032),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1033),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1034),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1035),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1036),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1100),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1101),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1102),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1103),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1150),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1151),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1200),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1201),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_FEATURE_XNACK_ANY_V4),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_FEATURE_XNACK_OFF_V4),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_FEATURE_XNACK_ON_V4),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_FEATURE_SRAMECC_ANY_V4),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_FEATURE_SRAMECC_OFF_V4),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_FEATURE_SRAMECC_ON_V4),
+ ENUM_ENT(EF_AMDGPU_MACH_NONE, "none"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_R600, "r600"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_R630, "r630"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_RS880, "rs880"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_RV670, "rv670"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_RV710, "rv710"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_RV730, "rv730"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_RV770, "rv770"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_CEDAR, "cedar"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_CYPRESS, "cypress"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_JUNIPER, "juniper"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_REDWOOD, "redwood"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_SUMO, "sumo"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_BARTS, "barts"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_CAICOS, "caicos"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_CAYMAN, "cayman"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_TURKS, "turks"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX600, "gfx600"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX601, "gfx601"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX602, "gfx602"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX700, "gfx700"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX701, "gfx701"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX702, "gfx702"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX703, "gfx703"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX704, "gfx704"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX705, "gfx705"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX801, "gfx801"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX802, "gfx802"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX803, "gfx803"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX805, "gfx805"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX810, "gfx810"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX900, "gfx900"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX902, "gfx902"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX904, "gfx904"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX906, "gfx906"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX908, "gfx908"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX909, "gfx909"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX90A, "gfx90a"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX90C, "gfx90c"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX940, "gfx940"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX941, "gfx941"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX942, "gfx942"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1010, "gfx1010"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1011, "gfx1011"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1012, "gfx1012"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1013, "gfx1013"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1030, "gfx1030"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1031, "gfx1031"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1032, "gfx1032"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1033, "gfx1033"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1034, "gfx1034"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1035, "gfx1035"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1036, "gfx1036"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1100, "gfx1100"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1101, "gfx1101"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1102, "gfx1102"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1103, "gfx1103"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1150, "gfx1150"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1151, "gfx1151"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1200, "gfx1200"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1201, "gfx1201"),
+ ENUM_ENT(EF_AMDGPU_FEATURE_XNACK_ANY_V4, "xnack"),
+ ENUM_ENT(EF_AMDGPU_FEATURE_XNACK_OFF_V4, "xnack-"),
+ ENUM_ENT(EF_AMDGPU_FEATURE_XNACK_ON_V4, "xnack+"),
+ ENUM_ENT(EF_AMDGPU_FEATURE_SRAMECC_ANY_V4, "sramecc"),
+ ENUM_ENT(EF_AMDGPU_FEATURE_SRAMECC_OFF_V4, "sramecc-"),
+ ENUM_ENT(EF_AMDGPU_FEATURE_SRAMECC_ON_V4, "sramecc+"),
};
const EnumEntry<unsigned> ElfHeaderNVPTXFlags[] = {
@@ -3599,7 +3599,18 @@ template <class ELFT> void GNUELFDumper<ELFT>::printFileHeaders() {
if (e.e_version == ELF::EV_CURRENT)
OS << " (current)";
OS << "\n";
- Str = enumToString(e.e_ident[ELF::EI_OSABI], ArrayRef(ElfOSABI));
+ auto OSABI = ArrayRef(ElfOSABI);
+ if (e.e_ident[ELF::EI_OSABI] >= ELF::ELFOSABI_FIRST_ARCH &&
+ e.e_ident[ELF::EI_OSABI] <= ELF::ELFOSABI_LAST_ARCH) {
+ switch (e.e_machine) {
+ case ELF::EM_AMDGPU:
+ OSABI = ArrayRef(AMDGPUElfOSABI);
+ break;
+ default:
+ break;
+ }
+ }
+ Str = enumToString(e.e_ident[ELF::EI_OSABI], OSABI);
printFields(OS, "OS/ABI:", Str);
printFields(OS,
"ABI Version:", std::to_string(e.e_ident[ELF::EI_ABIVERSION]));
@@ -3646,6 +3657,28 @@ template <class ELFT> void GNUELFDumper<ELFT>::printFileHeaders() {
else if (e.e_machine == EM_CUDA)
ElfFlags = printFlags(e.e_flags, ArrayRef(ElfHeaderNVPTXFlags),
unsigned(ELF::EF_CUDA_SM));
+ else if (e.e_machine == EM_AMDGPU) {
+ switch (e.e_ident[ELF::EI_ABIVERSION]) {
+ default:
+ break;
+ case 0:
+ // ELFOSABI_AMDGPU_PAL, ELFOSABI_AMDGPU_MESA3D support *_V3 flags.
+ [[fallthrough]];
+ case ELF::ELFABIVERSION_AMDGPU_HSA_V3:
+ ElfFlags =
+ printFlags(e.e_flags, ArrayRef(ElfHeaderAMDGPUFlagsABIVersion3),
+ unsigned(ELF::EF_AMDGPU_MACH));
+ break;
+ case ELF::ELFABIVERSION_AMDGPU_HSA_V4:
+ case ELF::ELFABIVERSION_AMDGPU_HSA_V5:
+ ElfFlags =
+ printFlags(e.e_flags, ArrayRef(ElfHeaderAMDGPUFlagsABIVersion4),
+ unsigned(ELF::EF_AMDGPU_MACH),
+ unsigned(ELF::EF_AMDGPU_FEATURE_XNACK_V4),
+ unsigned(ELF::EF_AMDGPU_FEATURE_SRAMECC_V4));
+ break;
+ }
+ }
Str = "0x" + utohexstr(e.e_flags);
if (!ElfFlags.empty())
Str = Str + ", " + ElfFlags;
More information about the llvm-commits
mailing list