summaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorLuis Machado <luis.machado@linaro.org>2021-05-21 10:40:32 +0100
committerNick Clifton <nickc@redhat.com>2021-05-21 10:40:32 +0100
commit894982bfccec66a1496785bbef4d46423345b8c8 (patch)
treeb1cc82e6ce9f4bab68f9aa2e30146ca5b73ab124 /bfd/elf.c
parent75b969ccb1b05c3fbcecb0b6bb392d7448ce7286 (diff)
[AArch64] MTE corefile support
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.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index 8ed1623dfc..a4cfaf1512 100644
--- 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);
}
}