S390: Support guarded-storage core note sections
authorAndreas Arnez <arnez@linux.vnet.ibm.com>
Thu, 29 Jun 2017 08:30:09 +0000 (10:30 +0200)
committerAndreas Arnez <arnez@linux.vnet.ibm.com>
Thu, 29 Jun 2017 08:30:09 +0000 (10:30 +0200)
Newer Linux kernel versions offer two new register sets in support of the
z/Architecture's guarded storage facility: NT_S390_GS_CB, the
"guarded-storage registers", and NT_S390_GS_BC, the "guarded-storage
broadcast control block".  This patch adds support for the respective core
notes sections to binutils.

bfd/ChangeLog:
* elf-bfd.h (elfcore_write_s390_gs_cb): Add prototype.
(elfcore_write_s390_gs_bc): Likewise.
* elf.c (elfcore_grok_s390_gs_cb): New function.
(elfcore_grok_s390_gs_bc): New function.
(elfcore_grok_note): Call them.
(elfcore_write_s390_gs_cb): New function.
(elfcore_write_s390_gs_bc): New function.
(elfcore_write_register_note): Call them.

binutils/ChangeLog:
* readelf.c (get_note_type): Add NT_S390_GS_CB and NT_S390_GS_BC.

include/ChangeLog:
* elf/common.h (NT_S390_GS_CB): New macro.
(NT_S390_GS_BC): Likewise.

bfd/ChangeLog
bfd/elf-bfd.h
bfd/elf.c
binutils/ChangeLog
binutils/readelf.c
include/ChangeLog
include/elf/common.h

index ad9eecb4b765ec6a266a3adce4f617ce1cf4d2ee..9c622354e1cbcc251f592b900b04fa9d7f6da5ed 100644 (file)
@@ -1,3 +1,14 @@
+2017-06-29  Andreas Arnez  <arnez@linux.vnet.ibm.com>
+
+       * elf-bfd.h (elfcore_write_s390_gs_cb): Add prototype.
+       (elfcore_write_s390_gs_bc): Likewise.
+       * elf.c (elfcore_grok_s390_gs_cb): New function.
+       (elfcore_grok_s390_gs_bc): New function.
+       (elfcore_grok_note): Call them.
+       (elfcore_write_s390_gs_cb): New function.
+       (elfcore_write_s390_gs_bc): New function.
+       (elfcore_write_register_note): Call them.
+
 2017-06-28  H.J. Lu  <hongjiu.lu@intel.com>
 
        * libbfd.c (_bfd_generic_get_section_contents): Don't call
index b889720e1f2e32c25f2000df031b1db0d07befe2..92a8e02e591d6c553f1efa769961a5e66129e221 100644 (file)
@@ -2533,6 +2533,10 @@ extern char *elfcore_write_s390_vxrs_low
   (bfd *, char *, int *, const void *, int);
 extern char *elfcore_write_s390_vxrs_high
   (bfd *, char *, int *, const void *, int);
+extern char *elfcore_write_s390_gs_cb
+  (bfd *, char *, int *, const void *, int);
+extern char *elfcore_write_s390_gs_bc
+  (bfd *, char *, int *, const void *, int);
 extern char *elfcore_write_arm_vfp
   (bfd *, char *, int *, const void *, int);
 extern char *elfcore_write_aarch_tls
index 76c6a5c6a7ca242107de0e0df0432643f7c871fc..a238d392b4cc477218e074a3f6b46de238d6d898 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -9190,6 +9190,18 @@ elfcore_grok_s390_vxrs_high (bfd *abfd, Elf_Internal_Note *note)
   return elfcore_make_note_pseudosection (abfd, ".reg-s390-vxrs-high", note);
 }
 
+static bfd_boolean
+elfcore_grok_s390_gs_cb (bfd *abfd, Elf_Internal_Note *note)
+{
+  return elfcore_make_note_pseudosection (abfd, ".reg-s390-gs-cb", note);
+}
+
+static bfd_boolean
+elfcore_grok_s390_gs_bc (bfd *abfd, Elf_Internal_Note *note)
+{
+  return elfcore_make_note_pseudosection (abfd, ".reg-s390-gs-bc", note);
+}
+
 static bfd_boolean
 elfcore_grok_arm_vfp (bfd *abfd, Elf_Internal_Note *note)
 {
@@ -9668,6 +9680,20 @@ elfcore_grok_note (bfd *abfd, Elf_Internal_Note *note)
       else
        return TRUE;
 
+    case NT_S390_GS_CB:
+      if (note->namesz == 6
+         && strcmp (note->namedata, "LINUX") == 0)
+       return elfcore_grok_s390_gs_bc (abfd, note);
+      else
+       return TRUE;
+
+    case NT_S390_GS_BC:
+      if (note->namesz == 6
+         && strcmp (note->namedata, "LINUX") == 0)
+       return elfcore_grok_s390_gs_cb (abfd, note);
+      else
+       return TRUE;
+
     case NT_ARM_VFP:
       if (note->namesz == 6
          && strcmp (note->namedata, "LINUX") == 0)
@@ -10727,6 +10753,32 @@ elfcore_write_s390_vxrs_high (bfd *abfd,
                             s390_vxrs_high, size);
 }
 
+char *
+elfcore_write_s390_gs_cb (bfd *abfd,
+                         char *buf,
+                         int *bufsiz,
+                         const void *s390_gs_cb,
+                         int size)
+{
+  char *note_name = "LINUX";
+  return elfcore_write_note (abfd, buf, bufsiz,
+                            note_name, NT_S390_GS_CB,
+                            s390_gs_cb, size);
+}
+
+char *
+elfcore_write_s390_gs_bc (bfd *abfd,
+                         char *buf,
+                         int *bufsiz,
+                         const void *s390_gs_bc,
+                         int size)
+{
+  char *note_name = "LINUX";
+  return elfcore_write_note (abfd, buf, bufsiz,
+                            note_name, NT_S390_GS_BC,
+                            s390_gs_bc, size);
+}
+
 char *
 elfcore_write_arm_vfp (bfd *abfd,
                       char *buf,
@@ -10815,6 +10867,10 @@ elfcore_write_register_note (bfd *abfd,
     return elfcore_write_s390_vxrs_low (abfd, buf, bufsiz, data, size);
   if (strcmp (section, ".reg-s390-vxrs-high") == 0)
     return elfcore_write_s390_vxrs_high (abfd, buf, bufsiz, data, size);
+  if (strcmp (section, ".reg-s390-gs-cb") == 0)
+    return elfcore_write_s390_gs_cb (abfd, buf, bufsiz, data, size);
+  if (strcmp (section, ".reg-s390-gs-bc") == 0)
+    return elfcore_write_s390_gs_bc (abfd, buf, bufsiz, data, size);
   if (strcmp (section, ".reg-arm-vfp") == 0)
     return elfcore_write_arm_vfp (abfd, buf, bufsiz, data, size);
   if (strcmp (section, ".reg-aarch-tls") == 0)
index f0ecdc675db0baa1f3ba95c5432c371e2a7c7124..14cfcffc8e7952708150fcab20880c7ebc14caea 100644 (file)
@@ -1,3 +1,7 @@
+2017-06-29  Andreas Arnez  <arnez@linux.vnet.ibm.com>
+
+       * readelf.c (get_note_type): Add NT_S390_GS_CB and NT_S390_GS_BC.
+
 2017-06-28  H.J. Lu  <hongjiu.lu@intel.com>
 
        * objdump.c (dump_relocs_in_section): Cast to ufile_ptr when
index df7e8c3406821b2a5105adffd0d87e1333589298..90af7cc39c1f90dbcf4c91d9dc6da6ca89bd453b 100644 (file)
@@ -16158,6 +16158,10 @@ get_note_type (unsigned e_type)
        return _("NT_S390_VXRS_LOW (s390 vector registers 0-15 upper half)");
       case NT_S390_VXRS_HIGH:
        return _("NT_S390_VXRS_HIGH (s390 vector registers 16-31)");
+      case NT_S390_GS_CB:
+       return _("NT_S390_GS_CB (s390 guarded-storage registers)");
+      case NT_S390_GS_BC:
+       return _("NT_S390_GS_BC (s390 guarded-storage broadcast control)");
       case NT_ARM_VFP:
        return _("NT_ARM_VFP (arm VFP registers)");
       case NT_ARM_TLS:
index cd5a51fc5a9d4b41663743f41f587517752df001..171d4bdb3c59fdae6b38b261b979b001917e25b5 100644 (file)
@@ -1,3 +1,8 @@
+2017-06-29  Andreas Arnez  <arnez@linux.vnet.ibm.com>
+
+       * elf/common.h (NT_S390_GS_CB): New macro.
+       (NT_S390_GS_BC): Likewise.
+
 2017-06-28  Tamar Christina  <tamar.christina@arm.com>
 
        * opcode/aarch64.h: (AARCH64_FEATURE_DOTPROD): New.
index 8ca14bcbea767b52d6631f078a271137027e6bea..2976c06067cbe2497ba56fae7d5cd5c7cb5e06a7 100644 (file)
                                        /*   note name must be "LINUX".  */
 #define NT_S390_VXRS_HIGH      0x30a   /* S390 vector registers 16-31 */
                                        /*   note name must be "LINUX".  */
+#define NT_S390_GS_CB  0x30b           /* s390 guarded storage registers */
+                                       /*   note name must be "LINUX".  */
+#define NT_S390_GS_BC  0x30c           /* s390 guarded storage broadcast control block */
+                                       /*   note name must be "LINUX".  */
 #define NT_ARM_VFP     0x400           /* ARM VFP registers */
 /* The following definitions should really use NT_AARCH_..., but defined
    this way for compatibility with Linux.  */