aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--binutils/ChangeLog5
-rw-r--r--binutils/readelf.c20
-rw-r--r--include/ChangeLog4
-rw-r--r--include/elf/amdgpu.h4
4 files changed, 33 insertions, 0 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 3ed0b0a..ea13226 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,5 +1,10 @@
2022-03-16 Simon Marchi <simon.marchi@efficios.com>
+ * readelf.c (get_amdgpu_elf_note_type): New.
+ (process_note): Handle "AMDGPU" notes.
+
+2022-03-16 Simon Marchi <simon.marchi@efficios.com>
+
* readelf.c: Include elf/amdgcn.h.
(decode_AMDGPU_machine_flags): New.
(get_machine_flags): Handle flags for EM_AMDGPU machine type.
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 00b5e54..91515bd 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -19724,6 +19724,22 @@ decode_x86_compat_2_isa (unsigned int bitmask)
}
}
+static const char *
+get_amdgpu_elf_note_type (unsigned int e_type)
+{
+ switch (e_type)
+ {
+ case NT_AMDGPU_METADATA:
+ return _("NT_AMDGPU_METADATA (code object metadata)");
+ default:
+ {
+ static char buf[64];
+ snprintf (buf, sizeof (buf), _("Unknown note type: (0x%08x)"), e_type);
+ return buf;
+ }
+ }
+}
+
static void
decode_x86_isa (unsigned int bitmask)
{
@@ -21313,6 +21329,10 @@ process_note (Elf_Internal_Note * pnote,
/* GNU-specific object file notes. */
nt = get_gnu_elf_note_type (pnote->type);
+ else if (startswith (pnote->namedata, "AMDGPU"))
+ /* AMDGPU-specific object file notes. */
+ nt = get_amdgpu_elf_note_type (pnote->type);
+
else if (startswith (pnote->namedata, "FreeBSD"))
/* FreeBSD-specific core file notes. */
nt = get_freebsd_elfcore_note_type (filedata, pnote->type);
diff --git a/include/ChangeLog b/include/ChangeLog
index 7807497..64aeb12 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,5 +1,9 @@
2022-03-16 Simon Marchi <simon.marchi@efficios.com>
+ * elf/amdgcn.h (NT_AMDGPU_METADATA): New.
+
+2022-03-16 Simon Marchi <simon.marchi@efficios.com>
+
* elf/amdgcn.h: Add EF_AMDGPU_MACH_AMDGCN_* and
EF_AMDGPU_FEATURE_* defines.
diff --git a/include/elf/amdgpu.h b/include/elf/amdgpu.h
index 005064f..e3c90dc 100644
--- a/include/elf/amdgpu.h
+++ b/include/elf/amdgpu.h
@@ -87,4 +87,8 @@
#define EF_AMDGPU_FEATURE_SRAMECC_OFF_V4 0x800
#define EF_AMDGPU_FEATURE_SRAMECC_ON_V4 0xc00
+/* Notes. */
+
+#define NT_AMDGPU_METADATA 32
+
#endif /* _ELF_AMDGPU_H */