This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] Add checks for the NT_ARM_SVE section in a core file.
- From: Nick Clifton <nickc at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 6 Jul 2018 15:26:08 -0000
- Subject: [binutils-gdb] Add checks for the NT_ARM_SVE section in a core file.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ad1cc4e492e51ff334df81b5e8610f91b50e373a
commit ad1cc4e492e51ff334df81b5e8610f91b50e373a
Author: Alan Hayward <alan.hayward@arm.com>
Date: Fri Jul 6 16:25:21 2018 +0100
Add checks for the NT_ARM_SVE section in a core file.
The NT_ARM_SVE section is documented here:
https://github.com/torvalds/linux/blob/master/Documentation/arm64/sve.txt
* A NT_ARM_SVE note will be added to each coredump for each thread of the
dumped process. The contents will be equivalent to the data that would have
been read if a PTRACE_GETREGSET of NT_ARM_SVE were executed for each thread
when the coredump was generated.
* elf.c (elfcore_grok_aarch_sve): New function.
(elfcore_grok_note): Check for Aarch64 SVE.
(elfcore_write_aarch_sve): New function.
(elfcore_write_register_note): Check for Aarch64 SVE.
* elf-bfd.h(elfcore_grok_aarch_sve): New declaration.
Diff:
---
bfd/ChangeLog | 8 ++++++++
bfd/elf-bfd.h | 2 ++
bfd/elf.c | 27 +++++++++++++++++++++++++++
3 files changed, 37 insertions(+)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index b844965..16d6daf 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,11 @@
+2018-07-06 Alan Hayward <alan.hayward@arm.com>
+
+ * elf.c (elfcore_grok_aarch_sve): New function.
+ (elfcore_grok_note): Check for Aarch64 SVE.
+ (elfcore_write_aarch_sve): New function.
+ (elfcore_write_register_note): Check for Aarch64 SVE.
+ * elf-bfd.h(elfcore_grok_aarch_sve): New declaration.
+
2018-07-06 Alan Modra <amodra@gmail.com>
* elf32-arm.c (elf32_arm_nabi_write_core_note): Don't use
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index e8eac7b..903dd9a 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -2602,6 +2602,8 @@ extern char *elfcore_write_aarch_hw_break
(bfd *, char *, int *, const void *, int);
extern char *elfcore_write_aarch_hw_watch
(bfd *, char *, int *, const void *, int);
+extern char *elfcore_write_aarch_sve
+ (bfd *, char *, int *, const void *, int);
extern char *elfcore_write_lwpstatus
(bfd *, char *, int *, long, int, const void *);
extern char *elfcore_write_register_note
diff --git a/bfd/elf.c b/bfd/elf.c
index 0f75375..feb2c65 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -9340,6 +9340,12 @@ elfcore_grok_aarch_hw_watch (bfd *abfd, Elf_Internal_Note *note)
return elfcore_make_note_pseudosection (abfd, ".reg-aarch-hw-watch", note);
}
+static bfd_boolean
+elfcore_grok_aarch_sve (bfd *abfd, Elf_Internal_Note *note)
+{
+ return elfcore_make_note_pseudosection (abfd, ".reg-aarch-sve", note);
+}
+
#if defined (HAVE_PRPSINFO_T)
typedef prpsinfo_t elfcore_psinfo_t;
#if defined (HAVE_PRPSINFO32_T) /* Sparc64 cross Sparc32 */
@@ -9836,6 +9842,13 @@ elfcore_grok_note (bfd *abfd, Elf_Internal_Note *note)
else
return TRUE;
+ case NT_ARM_SVE:
+ if (note->namesz == 6
+ && strcmp (note->namedata, "LINUX") == 0)
+ return elfcore_grok_aarch_sve (abfd, note);
+ else
+ return TRUE;
+
case NT_PRPSINFO:
case NT_PSINFO:
if (bed->elf_backend_grok_psinfo)
@@ -11028,6 +11041,18 @@ elfcore_write_aarch_hw_watch (bfd *abfd,
}
char *
+elfcore_write_aarch_sve (bfd *abfd,
+ char *buf,
+ int *bufsiz,
+ const void *aarch_sve,
+ int size)
+{
+ char *note_name = "LINUX";
+ return elfcore_write_note (abfd, buf, bufsiz,
+ note_name, NT_ARM_SVE, aarch_sve, size);
+}
+
+char *
elfcore_write_register_note (bfd *abfd,
char *buf,
int *bufsiz,
@@ -11079,6 +11104,8 @@ elfcore_write_register_note (bfd *abfd,
return elfcore_write_aarch_hw_break (abfd, buf, bufsiz, data, size);
if (strcmp (section, ".reg-aarch-hw-watch") == 0)
return elfcore_write_aarch_hw_watch (abfd, buf, bufsiz, data, size);
+ if (strcmp (section, ".reg-aarch-sve") == 0)
+ return elfcore_write_aarch_sve (abfd, buf, bufsiz, data, size);
return NULL;
}