diff options
author | Luis Machado <luis.machado@arm.com> | 2023-04-04 14:13:50 +0100 |
---|---|---|
committer | Luis Machado <luis.machado@arm.com> | 2023-08-21 12:43:43 +0100 |
commit | 11e3488d3f787d51196a115fd9c6085e57bd9626 (patch) | |
tree | 14513e9145f2d36f36b0cd7e99f5a15fa46686c3 /bfd | |
parent | 682267bfe4288c44ac725ba8abd7f2e790b45431 (diff) | |
download | gdb-11e3488d3f787d51196a115fd9c6085e57bd9626.zip gdb-11e3488d3f787d51196a115fd9c6085e57bd9626.tar.gz gdb-11e3488d3f787d51196a115fd9c6085e57bd9626.tar.bz2 |
aarch64/sme2: Teach binutils/BFD about the NT_ARM_ZT register set
The Scalable Matrix Extension v2 (SME2) defines a new register, ZT0, that
the Linux Kernel handles through a new NT_ARM_ZT register set.
Teach binutils/BFD about it so that gdb can make use of it for reading
and writing core files. This also enables readelf/objdump to show the
correct identification for the NT_ARM_ZT register set.
Validated under Fast Models.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/elf-bfd.h | 2 | ||||
-rw-r--r-- | bfd/elf.c | 37 |
2 files changed, 39 insertions, 0 deletions
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 659eef4..d9ab5bd 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -2944,6 +2944,8 @@ extern char *elfcore_write_aarch_ssve (bfd *, char *, int *, const void *, int); extern char *elfcore_write_aarch_za (bfd *, char *, int *, const void *, int); +extern char *elfcore_write_aarch_zt + (bfd *, char *, int *, const void *, int); extern char *elfcore_write_arc_v2 (bfd *, char *, int *, const void *, int); extern char *elfcore_write_riscv_csr @@ -10691,6 +10691,15 @@ elfcore_grok_aarch_za (bfd *abfd, Elf_Internal_Note *note) return elfcore_make_note_pseudosection (abfd, ".reg-aarch-za", note); } +/* Convert NOTE into a bfd_section called ".reg-aarch-zt". Return TRUE if + successful, otherwise return FALSE. */ + +static bool +elfcore_grok_aarch_zt (bfd *abfd, Elf_Internal_Note *note) +{ + return elfcore_make_note_pseudosection (abfd, ".reg-aarch-zt", note); +} + static bool elfcore_grok_arc_v2 (bfd *abfd, Elf_Internal_Note *note) { @@ -11420,6 +11429,13 @@ elfcore_grok_note (bfd *abfd, Elf_Internal_Note *note) else return true; + case NT_ARM_ZT: + if (note->namesz == 6 + && strcmp (note->namedata, "LINUX") == 0) + return elfcore_grok_aarch_zt (abfd, note); + else + return true; + case NT_GDB_TDESC: if (note->namesz == 4 && strcmp (note->namedata, "GDB") == 0) @@ -13062,6 +13078,25 @@ elfcore_write_aarch_za (bfd *abfd, size); } +/* Write the buffer of zt register values in aarch_zt (length SIZE) into + the note buffer BUF and update *BUFSIZ. ABFD is the bfd the note is being + written into. Return a pointer to the new start of the note buffer, to + replace BUF which may no longer be valid. */ + +char * +elfcore_write_aarch_zt (bfd *abfd, + char *buf, + int *bufsiz, + const void *aarch_zt, + int size) +{ + char *note_name = "LINUX"; + return elfcore_write_note (abfd, buf, bufsiz, + note_name, NT_ARM_ZT, + aarch_zt, + size); +} + char * elfcore_write_arc_v2 (bfd *abfd, char *buf, @@ -13247,6 +13282,8 @@ elfcore_write_register_note (bfd *abfd, return elfcore_write_aarch_ssve (abfd, buf, bufsiz, data, size); if (strcmp (section, ".reg-aarch-za") == 0) return elfcore_write_aarch_za (abfd, buf, bufsiz, data, size); + if (strcmp (section, ".reg-aarch-zt") == 0) + return elfcore_write_aarch_zt (abfd, buf, bufsiz, data, size); if (strcmp (section, ".reg-arc-v2") == 0) return elfcore_write_arc_v2 (abfd, buf, bufsiz, data, size); if (strcmp (section, ".gdb-tdesc") == 0) |