aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Hayward <alan.hayward@arm.com>2019-02-20 10:39:28 +0000
committerAlan Hayward <alan.hayward@arm.com>2019-02-20 10:39:28 +0000
commite6c3b5bfb449d1a02d26f3c4bae5b732951479fc (patch)
tree9fb625a78e11377adfcfdb56ae89ba67f74e4899 /bfd
parent34d75fb5c419a23922174c520e124523e01114c4 (diff)
downloadgdb-e6c3b5bfb449d1a02d26f3c4bae5b732951479fc.zip
gdb-e6c3b5bfb449d1a02d26f3c4bae5b732951479fc.tar.gz
gdb-e6c3b5bfb449d1a02d26f3c4bae5b732951479fc.tar.bz2
AArch64: Add pauth core file section
Used for the AArch64 pointer authentication code mask registers in Arm v8.3-a. NT_ARM_PAC_MASK matches the value in Linux include/uapi/linux/elf.h include/ChangeLog: * elf/common.h (NT_ARM_PAC_MASK): Add define. bfd/ChangeLog: * elf-bfd.h (elfcore_write_aarch_pauth): Add declaration. * elf.c (elfcore_grok_aarch_pauth): New function. (elfcore_grok_note): Check for NT_ARM_PAC_MASK. (elfcore_write_aarch_pauth): New function. (elfcore_write_register_note): Check for AArch64 pauth section.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog8
-rw-r--r--bfd/elf-bfd.h2
-rw-r--r--bfd/elf.c27
3 files changed, 37 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 8183678..c10f1a4 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,11 @@
+2019-02-20 Alan Hayward <alan.hayward@arm.com>
+
+ * elf-bfd.h (elfcore_write_aarch_pauth): Add declaration.
+ * elf.c (elfcore_grok_aarch_pauth): New function.
+ (elfcore_grok_note): Check for NT_ARM_PAC_MASK.
+ (elfcore_write_aarch_pauth): New function.
+ (elfcore_write_register_note): Check for AArch64 pauth section.
+
2019-02-20 Alan Modra <amodra@gmail.com>
PR 24225
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 5741c60..56cddda 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -2634,6 +2634,8 @@ 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_aarch_pauth
+ (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 eb3e182..f16acaa 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -9541,6 +9541,12 @@ elfcore_grok_aarch_sve (bfd *abfd, Elf_Internal_Note *note)
return elfcore_make_note_pseudosection (abfd, ".reg-aarch-sve", note);
}
+static bfd_boolean
+elfcore_grok_aarch_pauth (bfd *abfd, Elf_Internal_Note *note)
+{
+ return elfcore_make_note_pseudosection (abfd, ".reg-aarch-pauth", note);
+}
+
#if defined (HAVE_PRPSINFO_T)
typedef prpsinfo_t elfcore_psinfo_t;
#if defined (HAVE_PRPSINFO32_T) /* Sparc64 cross Sparc32 */
@@ -10135,6 +10141,13 @@ elfcore_grok_note (bfd *abfd, Elf_Internal_Note *note)
else
return TRUE;
+ case NT_ARM_PAC_MASK:
+ if (note->namesz == 6
+ && strcmp (note->namedata, "LINUX") == 0)
+ return elfcore_grok_aarch_pauth (abfd, note);
+ else
+ return TRUE;
+
case NT_PRPSINFO:
case NT_PSINFO:
if (bed->elf_backend_grok_psinfo)
@@ -11495,6 +11508,18 @@ elfcore_write_aarch_sve (bfd *abfd,
}
char *
+elfcore_write_aarch_pauth (bfd *abfd,
+ char *buf,
+ int *bufsiz,
+ const void *aarch_pauth,
+ int size)
+{
+ char *note_name = "LINUX";
+ return elfcore_write_note (abfd, buf, bufsiz,
+ note_name, NT_ARM_PAC_MASK, aarch_pauth, size);
+}
+
+char *
elfcore_write_register_note (bfd *abfd,
char *buf,
int *bufsiz,
@@ -11574,6 +11599,8 @@ elfcore_write_register_note (bfd *abfd,
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);
+ if (strcmp (section, ".reg-aarch-pauth") == 0)
+ return elfcore_write_aarch_pauth (abfd, buf, bufsiz, data, size);
return NULL;
}