[binutils-gdb] bfd: Handle note of type NT_X86_SHSTK
H.J. Lu
hjl@sourceware.org
Sun May 18 20:36:46 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c44fc1d6b4a1625b8f08e81c39d312fb5d9567c2
commit c44fc1d6b4a1625b8f08e81c39d312fb5d9567c2
Author: Christina Schimpe <christina.schimpe@intel.com>
Date: Thu Feb 13 16:40:23 2025 +0000
bfd: Handle note of type NT_X86_SHSTK
Diff:
---
bfd/elf.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/bfd/elf.c b/bfd/elf.c
index b6f50701928..3073f860621 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -10391,6 +10391,12 @@ elfcore_grok_xstatereg (bfd *abfd, Elf_Internal_Note *note)
return elfcore_make_note_pseudosection (abfd, ".reg-xstate", note);
}
+static bool
+elfcore_grok_sspreg (bfd *abfd, Elf_Internal_Note *note)
+{
+ return elfcore_make_note_pseudosection (abfd, ".reg-ssp", note);
+}
+
static bool
elfcore_grok_ppc_vmx (bfd *abfd, Elf_Internal_Note *note)
{
@@ -11086,6 +11092,13 @@ elfcore_grok_note (bfd *abfd, Elf_Internal_Note *note)
else
return true;
+ case NT_X86_SHSTK: /* Linux CET extension. */
+ if (note->namesz == 6
+ && strcmp (note->namedata, "LINUX") == 0)
+ return elfcore_grok_sspreg (abfd, note);
+ else
+ return true;
+
case NT_PPC_VMX:
if (note->namesz == 6
&& strcmp (note->namedata, "LINUX") == 0)
@@ -12536,6 +12549,15 @@ elfcore_write_xstatereg (bfd *abfd, char *buf, int *bufsiz,
note_name, NT_X86_XSTATE, xfpregs, size);
}
+static char *
+elfcore_write_sspreg (bfd *abfd, char *buf, int *bufsiz,
+ const void *ssp, int size)
+{
+ const char *note_name = "LINUX";
+ return elfcore_write_note (abfd, buf, bufsiz,
+ note_name, NT_X86_SHSTK, ssp, size);
+}
+
char *
elfcore_write_x86_segbases (bfd *abfd, char *buf, int *bufsiz,
const void *regs, int size)
@@ -13131,6 +13153,8 @@ elfcore_write_register_note (bfd *abfd,
return elfcore_write_xstatereg (abfd, buf, bufsiz, data, size);
if (strcmp (section, ".reg-x86-segbases") == 0)
return elfcore_write_x86_segbases (abfd, buf, bufsiz, data, size);
+ if (strcmp (section, ".reg-ssp") == 0)
+ return elfcore_write_sspreg (abfd, buf, bufsiz, data, size);
if (strcmp (section, ".reg-ppc-vmx") == 0)
return elfcore_write_ppc_vmx (abfd, buf, bufsiz, data, size);
if (strcmp (section, ".reg-ppc-vsx") == 0)
More information about the Binutils-cvs
mailing list