]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
binutils/readelf: handle NT_AMDGPU_METADATA note name
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 16 Mar 2022 13:01:26 +0000 (09:01 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Wed, 16 Mar 2022 13:01:26 +0000 (09:01 -0400)
Handle the NT_AMDGPU_METADATA note, which is described here:

  https://llvm.org/docs/AMDGPUUsage.html#code-object-v3-note-records

As of this patch, just print out the name, not the contents, which is in
the msgpack format.

binutils/ChangeLog:

* readelf.c (get_amdgpu_elf_note_type): New.
(process_note): Handle "AMDGPU" notes.

include/ChangeLog:

* elf/amdgcn.h (NT_AMDGPU_METADATA): New.

Change-Id: Id2dba2e2aeaa55ef7464fb35aee9c7d5f96ddb23

binutils/ChangeLog
binutils/readelf.c
include/ChangeLog
include/elf/amdgpu.h

index 3ed0b0a7fd87d6f883da172870df43a6b2289b47..ea132260e672d0dacead74f2436437c60f2b2a46 100644 (file)
@@ -1,3 +1,8 @@
+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.
index 00b5e546c1e74177be03d07a8103b75fe3af42e9..91515bdf0faa11875d4e30384a3e20365a1a2051 100644 (file)
@@ -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);
index 7807497b0adefc1e77a561e8c750e6d2087f2ac1..64aeb12839860804d987459b3eaaf48981bd7774 100644 (file)
@@ -1,3 +1,7 @@
+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
index 005064fc264e6938bbba1275b73dffd162b1cc21..e3c90dc74e85df935c757c3aaa64f1a22167b17a 100644 (file)
@@ -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 */