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

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