0b42f8
commit 4ef9f41a9538c9c7e4e540277e437b137cb64c4c
0b42f8
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
0b42f8
Date:   Fri Feb 20 10:39:53 2015 +0100
0b42f8
0b42f8
    S390: Support new vector register sections
0b42f8
    
0b42f8
    The IBM z13 has new 128-bit wide vector registers v0-v31, where v0-v15
0b42f8
    include the existing 64-bit wide floating point registers.  The Linux
0b42f8
    kernel presents the vector registers as two additional register sets,
0b42f8
    one for the right halves of v0-v15 and another one for the full
0b42f8
    registers v16-v31.  Thus a new core file may contain two new register
0b42f8
    note sections, and this patch adds support to binutils for them.
0b42f8
    
0b42f8
    bfd/
0b42f8
    	* elf-bfd.h (elfcore_write_s390_vxrs_low): Add prototype.
0b42f8
    	(elfcore_write_s390_vxrs_high): Likewise.
0b42f8
    	* elf.c (elfcore_grok_s390_vxrs_low): New function.
0b42f8
    	(elfcore_grok_s390_vxrs_high): New function.
0b42f8
    	(elfcore_grok_note): Call them.
0b42f8
    	(elfcore_write_s390_vxrs_low): New function.
0b42f8
    	(elfcore_write_s390_vxrs_high): New function.
0b42f8
    	(elfcore_write_register_note): Call them.
0b42f8
    
0b42f8
    binutils/
0b42f8
    	* readelf.c (get_note_type): Add NT_S390_VXRS_LOW and
0b42f8
    	NT_S390_VXRS_HIGH.
0b42f8
    
0b42f8
    include/elf/
0b42f8
    	* common.h (NT_S390_VXRS_LOW): New macro.
0b42f8
    	(NT_S390_VXRS_HIGH): Likewise.
0b42f8
0b42f8
### a/bfd/ChangeLog
0b42f8
### b/bfd/ChangeLog
0b42f8
## -1,3 +1,14 @@
0b42f8
+2015-02-20  Andreas Arnez  <arnez@linux.vnet.ibm.com>
0b42f8
+
0b42f8
+	* elf-bfd.h (elfcore_write_s390_vxrs_low): Add prototype.
0b42f8
+	(elfcore_write_s390_vxrs_high): Likewise.
0b42f8
+	* elf.c (elfcore_grok_s390_vxrs_low): New function.
0b42f8
+	(elfcore_grok_s390_vxrs_high): New function.
0b42f8
+	(elfcore_grok_note): Call them.
0b42f8
+	(elfcore_write_s390_vxrs_low): New function.
0b42f8
+	(elfcore_write_s390_vxrs_high): New function.
0b42f8
+	(elfcore_write_register_note): Call them.
0b42f8
+
0b42f8
 2015-02-19  Branko Drevensek  <branko.drevensek@gmail.com>
0b42f8
 
0b42f8
 	PR 17995
0b42f8
--- a/bfd/elf-bfd.h
0b42f8
+++ b/bfd/elf-bfd.h
0b42f8
@@ -2285,6 +2285,10 @@ extern char *elfcore_write_s390_system_call
0b42f8
   (bfd *, char *, int *, const void *, int);
0b42f8
 extern char *elfcore_write_s390_tdb
0b42f8
   (bfd *, char *, int *, const void *, int);
0b42f8
+extern char *elfcore_write_s390_vxrs_low
0b42f8
+  (bfd *, char *, int *, const void *, int);
0b42f8
+extern char *elfcore_write_s390_vxrs_high
0b42f8
+  (bfd *, char *, int *, const void *, int);
0b42f8
 extern char *elfcore_write_arm_vfp
0b42f8
   (bfd *, char *, int *, const void *, int);
0b42f8
 extern char *elfcore_write_aarch_tls
0b42f8
--- a/bfd/elf.c
0b42f8
+++ b/bfd/elf.c
0b42f8
@@ -8251,6 +8251,18 @@ elfcore_grok_s390_tdb (bfd *abfd, Elf_Internal_Note *note)
0b42f8
 }
0b42f8
 
0b42f8
 static bfd_boolean
0b42f8
+elfcore_grok_s390_vxrs_low (bfd *abfd, Elf_Internal_Note *note)
0b42f8
+{
0b42f8
+  return elfcore_make_note_pseudosection (abfd, ".reg-s390-vxrs-low", note);
0b42f8
+}
0b42f8
+
0b42f8
+static bfd_boolean
0b42f8
+elfcore_grok_s390_vxrs_high (bfd *abfd, Elf_Internal_Note *note)
0b42f8
+{
0b42f8
+  return elfcore_make_note_pseudosection (abfd, ".reg-s390-vxrs-high", note);
0b42f8
+}
0b42f8
+
0b42f8
+static bfd_boolean
0b42f8
 elfcore_grok_arm_vfp (bfd *abfd, Elf_Internal_Note *note)
0b42f8
 {
0b42f8
   return elfcore_make_note_pseudosection (abfd, ".reg-arm-vfp", note);
0b42f8
@@ -8714,6 +8726,20 @@ elfcore_grok_note (bfd *abfd, Elf_Internal_Note *note)
0b42f8
       else
0b42f8
         return TRUE;
0b42f8
 
0b42f8
+    case NT_S390_VXRS_LOW:
0b42f8
+      if (note->namesz == 6
0b42f8
+	  && strcmp (note->namedata, "LINUX") == 0)
0b42f8
+	return elfcore_grok_s390_vxrs_low (abfd, note);
0b42f8
+      else
0b42f8
+	return TRUE;
0b42f8
+
0b42f8
+    case NT_S390_VXRS_HIGH:
0b42f8
+      if (note->namesz == 6
0b42f8
+	  && strcmp (note->namedata, "LINUX") == 0)
0b42f8
+	return elfcore_grok_s390_vxrs_high (abfd, note);
0b42f8
+      else
0b42f8
+	return TRUE;
0b42f8
+
0b42f8
     case NT_ARM_VFP:
0b42f8
       if (note->namesz == 6
0b42f8
 	  && strcmp (note->namedata, "LINUX") == 0)
0b42f8
@@ -9580,6 +9606,31 @@ elfcore_write_s390_tdb (bfd *abfd,
0b42f8
 }
0b42f8
 
0b42f8
 char *
0b42f8
+elfcore_write_s390_vxrs_low (bfd *abfd,
0b42f8
+			     char *buf,
0b42f8
+			     int *bufsiz,
0b42f8
+			     const void *s390_vxrs_low,
0b42f8
+			     int size)
0b42f8
+{
0b42f8
+  char *note_name = "LINUX";
0b42f8
+  return elfcore_write_note (abfd, buf, bufsiz,
0b42f8
+			     note_name, NT_S390_VXRS_LOW, s390_vxrs_low, size);
0b42f8
+}
0b42f8
+
0b42f8
+char *
0b42f8
+elfcore_write_s390_vxrs_high (bfd *abfd,
0b42f8
+			     char *buf,
0b42f8
+			     int *bufsiz,
0b42f8
+			     const void *s390_vxrs_high,
0b42f8
+			     int size)
0b42f8
+{
0b42f8
+  char *note_name = "LINUX";
0b42f8
+  return elfcore_write_note (abfd, buf, bufsiz,
0b42f8
+			     note_name, NT_S390_VXRS_HIGH,
0b42f8
+			     s390_vxrs_high, size);
0b42f8
+}
0b42f8
+
0b42f8
+char *
0b42f8
 elfcore_write_arm_vfp (bfd *abfd,
0b42f8
 		       char *buf,
0b42f8
 		       int *bufsiz,
0b42f8
@@ -9663,6 +9714,10 @@ elfcore_write_register_note (bfd *abfd,
0b42f8
     return elfcore_write_s390_system_call (abfd, buf, bufsiz, data, size);
0b42f8
   if (strcmp (section, ".reg-s390-tdb") == 0)
0b42f8
     return elfcore_write_s390_tdb (abfd, buf, bufsiz, data, size);
0b42f8
+  if (strcmp (section, ".reg-s390-vxrs-low") == 0)
0b42f8
+    return elfcore_write_s390_vxrs_low (abfd, buf, bufsiz, data, size);
0b42f8
+  if (strcmp (section, ".reg-s390-vxrs-high") == 0)
0b42f8
+    return elfcore_write_s390_vxrs_high (abfd, buf, bufsiz, data, size);
0b42f8
   if (strcmp (section, ".reg-arm-vfp") == 0)
0b42f8
     return elfcore_write_arm_vfp (abfd, buf, bufsiz, data, size);
0b42f8
   if (strcmp (section, ".reg-aarch-tls") == 0)
0b42f8
### a/include/elf/ChangeLog
0b42f8
### b/include/elf/ChangeLog
0b42f8
## -1,3 +1,8 @@
0b42f8
+2015-02-20  Andreas Arnez  <arnez@linux.vnet.ibm.com>
0b42f8
+
0b42f8
+	* common.h (NT_S390_VXRS_LOW): New macro.
0b42f8
+	(NT_S390_VXRS_HIGH): Likewise.
0b42f8
+
0b42f8
 2015-01-28  James Bowman  <james.bowman@ftdichip.com>
0b42f8
 
0b42f8
 	* common.h (EM_FT32): Define.
0b42f8
--- a/include/elf/common.h
0b42f8
+++ b/include/elf/common.h
0b42f8
@@ -557,6 +557,10 @@
0b42f8
 					/*   note name must be "LINUX".  */
0b42f8
 #define NT_S390_TDB	0x308		/* S390 transaction diagnostic block */
0b42f8
 					/*   note name must be "LINUX".  */
0b42f8
+#define NT_S390_VXRS_LOW	0x309	/* S390 vector registers 0-15 upper half */
0b42f8
+					/*   note name must be "LINUX".  */
0b42f8
+#define NT_S390_VXRS_HIGH	0x30a	/* S390 vector registers 16-31 */
0b42f8
+					/*   note name must be "LINUX".  */
0b42f8
 #define NT_ARM_VFP	0x400		/* ARM VFP registers */
0b42f8
 /* The following definitions should really use NT_AARCH_..., but defined
0b42f8
    this way for compatibility with Linux.  */