[AArch64] MTE corefile support
authorLuis Machado <luis.machado@linaro.org>
Fri, 21 May 2021 09:40:32 +0000 (10:40 +0100)
committerNick Clifton <nickc@redhat.com>
Fri, 21 May 2021 09:40:32 +0000 (10:40 +0100)
bfd * elf.c (elfcore_make_memtag_note_section): New function.
(elfcore_grok_note): Handle NT_MEMTAG note types.

binutils* readelf.c (get_note_type): Handle NT_MEMTAG note types.

include * elf/common.h (NT_MEMTAG): New constant.
(NT_MEMTAG_TYPE_AARCH_MTE): New constant.

bfd/ChangeLog
bfd/elf.c
binutils/ChangeLog
binutils/readelf.c
include/ChangeLog
include/elf/common.h

index 2ad7803301583b0c12e2ddcc431f6f2c3df2d4d1..b614bd46e31896db57b842ce501348a41a037263 100644 (file)
@@ -1,3 +1,8 @@
+2021-05-21  Luis Machado  <luis.machado@linaro.org>
+
+       * elf.c (elfcore_make_memtag_note_section): New function.
+       (elfcore_grok_note): Handle NT_MEMTAG note types.
+
 2021-05-20  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * section.c (bfd_get_section_by_name): Return NULL if name is
index 8ed1623dfc1d38c88878167a5eab3c2c89416b4f..a4cfaf1512f6b31b68c8f068a7bf10dadfaf62a2 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -9597,6 +9597,23 @@ elfcore_make_auxv_note_section (bfd *abfd, Elf_Internal_Note *note,
   return true;
 }
 
+static bool
+elfcore_make_memtag_note_section (bfd *abfd, Elf_Internal_Note *note,
+                                 size_t offs)
+{
+  asection *sect = bfd_make_section_anyway_with_flags (abfd, ".memtag",
+                                                      SEC_HAS_CONTENTS);
+
+  if (sect == NULL)
+    return false;
+
+  sect->size = note->descsz - offs;
+  sect->filepos = note->descpos + offs;
+  sect->alignment_power = 1 + bfd_get_arch_size (abfd) / 32;
+
+  return true;
+}
+
 /* prstatus_t exists on:
      solaris 2.5+
      linux 2.[01] + glibc
@@ -10657,6 +10674,8 @@ elfcore_grok_note (bfd *abfd, Elf_Internal_Note *note)
       return elfcore_make_note_pseudosection (abfd, ".note.linuxcore.siginfo",
                                              note);
 
+    case NT_MEMTAG:
+      return elfcore_make_memtag_note_section (abfd, note, 0);
     }
 }
 
index 1795f4138cab890d67570e513cbfa0b07fb58c52..b765188ae2de3567a485de060fcb70e149744180 100644 (file)
@@ -1,3 +1,7 @@
+2021-05-21  Luis Machado  <luis.machado@linaro.org>
+
+       * readelf.c (get_note_type): Handle NT_MEMTAG note types.
+
 2021-05-19  Eli Schwartz  <eschwartz@archlinux.org>
 
        * dwarf.c (ENABLE_CHECKING): Define to 0 if not previously set.
index cf2011753c8d853792e0763362056f698f17ead0..656df642deef68eb95a0f0d3158446d53b432a6e 100644 (file)
@@ -18696,6 +18696,8 @@ get_note_type (Filedata * filedata, unsigned e_type)
        return _("NT_SIGINFO (siginfo_t data)");
       case NT_FILE:
        return _("NT_FILE (mapped files)");
+      case NT_MEMTAG:
+       return _("NT_MEMTAG (memory tags)");
       default:
        break;
       }
index e22f3e85452ba1282ffaefccf520ddc3e7664452..fdb2a7bc594d49929f7ebd8e32f2e2286c4aae58 100644 (file)
@@ -1,3 +1,8 @@
+2021-05-21  Luis Machado  <luis.machado@linaro.org>
+
+       * elf/common.h (NT_MEMTAG): New constant.
+       (NT_MEMTAG_TYPE_AARCH_MTE): New constant.
+
 2021-05-07  ClĂ©ment Chigot  <clement.chigot@atos.net>
 
        * coff/internal.h (C_DWARF): New define.
index f36bb0b80a292a99b36e939d9d16406900733a00..234aef084b2f2e84caa86de896029fd0e97d9b56 100644 (file)
 /* The range 0xff000000 to 0xffffffff is set aside for notes that don't
    originate from any particular operating system.  */
 #define NT_GDB_TDESC   0xff000000      /* Contains copy of GDB's target description XML.  */
+#define NT_MEMTAG      0xff000001      /* Contains a copy of the memory tags.  */
+
+/* NT_MEMTAG record types.  */
+
+/* ARM-specific NT_MEMTAG types.  */
+#define NT_MEMTAG_TYPE_AARCH_MTE  0x400        /* MTE memory tags for AArch64.  */
 
 /* Note segments for core files on dir-style procfs systems.  */
 
This page took 0.039654 seconds and 4 git commands to generate.