aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2022-03-16 09:01:15 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2022-03-16 09:01:15 -0400
commitc077c5802c396e4548516f15c8f03d7684b236ef (patch)
tree74438621c9ae1313a00db836b9546019fc188943 /include
parent37870be8740a4f903a61d43e6c1adede415473a9 (diff)
downloadgdb-c077c5802c396e4548516f15c8f03d7684b236ef.zip
gdb-c077c5802c396e4548516f15c8f03d7684b236ef.tar.gz
gdb-c077c5802c396e4548516f15c8f03d7684b236ef.tar.bz2
binutils/readelf: decode AMDGPU-specific e_flags
Decode and print the AMDGPU-specific fields of e_flags, as documented here: https://llvm.org/docs/AMDGPUUsage.html#header That is: - The specific GPU model - Whether the xnack and sramecc features are enabled The result looks like: - Flags: 0x52f + Flags: 0x52f, gfx906, xnack any, sramecc any The flags for the "HSA" OS ABI are properly versioned and documented on that page. But the NONE, PAL and MESA3D OS ABIs are not well documented nor versioned. Taking a peek at the LLVM source code, we see that they encode their flags the same way as HSA v3. For example, for PAL: https://github.com/llvm/llvm-project/blob/c8b614cd74a92d85936aed5ac7c642af75ffdc29/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp#L601 So for those other OS ABIs, we read them the same as HSA v3. binutils/ChangeLog: * readelf.c: Include elf/amdgcn.h. (decode_AMDGPU_machine_flags): New. (get_machine_flags): Handle flags for EM_AMDGPU machine type. include/ChangeLog: * elf/amdgcn.h: Add EF_AMDGPU_MACH_AMDGCN_* and EF_AMDGPU_FEATURE_* defines. Change-Id: Ib5b94df7cae0719a22cf4e4fd0629330e9485c12
Diffstat (limited to 'include')
-rw-r--r--include/ChangeLog5
-rw-r--r--include/elf/amdgpu.h54
2 files changed, 59 insertions, 0 deletions
diff --git a/include/ChangeLog b/include/ChangeLog
index 297dcd6..7807497 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,5 +1,10 @@
2022-03-16 Simon Marchi <simon.marchi@efficios.com>
+ * elf/amdgcn.h: Add EF_AMDGPU_MACH_AMDGCN_* and
+ EF_AMDGPU_FEATURE_* defines.
+
+2022-03-16 Simon Marchi <simon.marchi@efficios.com>
+
* elf/common.h (ELFOSABI_AMDGPU_PAL, ELFOSABI_AMDGPU_MESA3D):
New.
diff --git a/include/elf/amdgpu.h b/include/elf/amdgpu.h
index daa472e..005064f 100644
--- a/include/elf/amdgpu.h
+++ b/include/elf/amdgpu.h
@@ -33,4 +33,58 @@
#define EF_AMDGPU_MACH 0x0ff
#define EF_AMDGPU_MACH_AMDGCN_MIN 0x020
+#define EF_AMDGPU_MACH_AMDGCN_GFX600 0x020
+#define EF_AMDGPU_MACH_AMDGCN_GFX601 0x021
+#define EF_AMDGPU_MACH_AMDGCN_GFX700 0x022
+#define EF_AMDGPU_MACH_AMDGCN_GFX701 0x023
+#define EF_AMDGPU_MACH_AMDGCN_GFX702 0x024
+#define EF_AMDGPU_MACH_AMDGCN_GFX703 0x025
+#define EF_AMDGPU_MACH_AMDGCN_GFX704 0x026
+#define EF_AMDGPU_MACH_AMDGCN_GFX801 0x028
+#define EF_AMDGPU_MACH_AMDGCN_GFX802 0x029
+#define EF_AMDGPU_MACH_AMDGCN_GFX803 0x02a
+#define EF_AMDGPU_MACH_AMDGCN_GFX810 0x02b
+#define EF_AMDGPU_MACH_AMDGCN_GFX900 0x02c
+#define EF_AMDGPU_MACH_AMDGCN_GFX902 0x02d
+#define EF_AMDGPU_MACH_AMDGCN_GFX904 0x02e
+#define EF_AMDGPU_MACH_AMDGCN_GFX906 0x02f
+#define EF_AMDGPU_MACH_AMDGCN_GFX908 0x030
+#define EF_AMDGPU_MACH_AMDGCN_GFX909 0x031
+#define EF_AMDGPU_MACH_AMDGCN_GFX90C 0x032
+#define EF_AMDGPU_MACH_AMDGCN_GFX1010 0x033
+#define EF_AMDGPU_MACH_AMDGCN_GFX1011 0x034
+#define EF_AMDGPU_MACH_AMDGCN_GFX1012 0x035
+#define EF_AMDGPU_MACH_AMDGCN_GFX1030 0x036
+#define EF_AMDGPU_MACH_AMDGCN_GFX1031 0x037
+#define EF_AMDGPU_MACH_AMDGCN_GFX1032 0x038
+#define EF_AMDGPU_MACH_AMDGCN_GFX1033 0x039
+#define EF_AMDGPU_MACH_AMDGCN_GFX602 0x03a
+#define EF_AMDGPU_MACH_AMDGCN_GFX705 0x03b
+#define EF_AMDGPU_MACH_AMDGCN_GFX805 0x03c
+#define EF_AMDGPU_MACH_AMDGCN_GFX1035 0x03d
+#define EF_AMDGPU_MACH_AMDGCN_GFX1034 0x03e
+#define EF_AMDGPU_MACH_AMDGCN_GFX90A 0x03f
+#define EF_AMDGPU_MACH_AMDGCN_GFX940 0x040
+#define EF_AMDGPU_MACH_AMDGCN_GFX1013 0x042
+#define EF_AMDGPU_MACH_AMDGCN_GFX1036 0x045
+
+/* Code object v3 machine flags. */
+
+#define EF_AMDGPU_FEATURE_XNACK_V3 0x100
+#define EF_AMDGPU_FEATURE_SRAMECC_V3 0x200
+
+/* Code object v4 (and later) machine flags. */
+
+#define EF_AMDGPU_FEATURE_XNACK_V4 0x300
+#define EF_AMDGPU_FEATURE_XNACK_UNSUPPORTED_V4 0x000
+#define EF_AMDGPU_FEATURE_XNACK_ANY_V4 0x100
+#define EF_AMDGPU_FEATURE_XNACK_OFF_V4 0x200
+#define EF_AMDGPU_FEATURE_XNACK_ON_V4 0x300
+
+#define EF_AMDGPU_FEATURE_SRAMECC_V4 0xc00
+#define EF_AMDGPU_FEATURE_SRAMECC_UNSUPPORTED_V4 0x000
+#define EF_AMDGPU_FEATURE_SRAMECC_ANY_V4 0x400
+#define EF_AMDGPU_FEATURE_SRAMECC_OFF_V4 0x800
+#define EF_AMDGPU_FEATURE_SRAMECC_ON_V4 0xc00
+
#endif /* _ELF_AMDGPU_H */