Blame SOURCES/gdb-rhbz1182151-ibm-z13-05of22.patch

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