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

0b42f8
commit 643f7afb0d7f63dcff873d3cbfd7ed3eaf94197f
0b42f8
Author: Andreas Krebbel <krebbel@linux.vnet.ibm.com>
0b42f8
Date:   Mon Apr 27 10:32:23 2015 +0200
0b42f8
0b42f8
    S/390: z13 use GNU attribute to indicate vector ABI
0b42f8
    
0b42f8
    bfd/
0b42f8
    	* elf-s390-common.c (elf_s390_merge_obj_attributes): New function.
0b42f8
    	* elf32-s390.c (elf32_s390_merge_private_bfd_data): Call
0b42f8
    	elf_s390_merge_obj_attributes.
0b42f8
    	* elf64-s390.c (elf64_s390_merge_private_bfd_data): New function.
0b42f8
    
0b42f8
    binutils/
0b42f8
    	* readelf.c (display_s390_gnu_attribute): New function.
0b42f8
    	(process_s390_specific): New function.
0b42f8
    	(process_arch_specific): Call process_s390_specific.
0b42f8
    
0b42f8
    gas/
0b42f8
    	* doc/as.texinfo: Document Tag_GNU_S390_ABI_Vector.
0b42f8
    
0b42f8
    include/elf/
0b42f8
    	* s390.h: Define Tag_GNU_S390_ABI_Vector.
0b42f8
0b42f8
### a/bfd/ChangeLog
0b42f8
### b/bfd/ChangeLog
0b42f8
## -1,3 +1,10 @@
0b42f8
+2015-04-27  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
0b42f8
+
0b42f8
+	* elf-s390-common.c (elf_s390_merge_obj_attributes): New function.
0b42f8
+	* elf32-s390.c (elf32_s390_merge_private_bfd_data): Call
0b42f8
+	elf_s390_merge_obj_attributes.
0b42f8
+	* elf64-s390.c (elf64_s390_merge_private_bfd_data): New function.
0b42f8
+
0b42f8
 2015-04-24  Jiong Wang  <jiong.wang@arm.com>
0b42f8
 
0b42f8
 	PR ld/18270
0b42f8
Index: gdb-7.6.1/bfd/elf-s390-common.c
0b42f8
===================================================================
0b42f8
--- gdb-7.6.1.orig/bfd/elf-s390-common.c	2016-02-21 22:12:48.164552653 +0100
0b42f8
+++ gdb-7.6.1/bfd/elf-s390-common.c	2016-02-21 22:12:55.355638653 +0100
0b42f8
@@ -241,3 +241,61 @@
0b42f8
 
0b42f8
   return TRUE;
0b42f8
 }
0b42f8
+
0b42f8
+/* Merge object attributes from IBFD into OBFD.  Raise an error if
0b42f8
+   there are conflicting attributes.  */
0b42f8
+static bfd_boolean
0b42f8
+elf_s390_merge_obj_attributes (bfd *ibfd, bfd *obfd)
0b42f8
+{
0b42f8
+  obj_attribute *in_attr, *in_attrs;
0b42f8
+  obj_attribute *out_attr, *out_attrs;
0b42f8
+
0b42f8
+  if (!elf_known_obj_attributes_proc (obfd)[0].i)
0b42f8
+    {
0b42f8
+      /* This is the first object.  Copy the attributes.  */
0b42f8
+      _bfd_elf_copy_obj_attributes (ibfd, obfd);
0b42f8
+
0b42f8
+      /* Use the Tag_null value to indicate the attributes have been
0b42f8
+	 initialized.  */
0b42f8
+      elf_known_obj_attributes_proc (obfd)[0].i = 1;
0b42f8
+
0b42f8
+      return TRUE;
0b42f8
+    }
0b42f8
+
0b42f8
+  in_attrs = elf_known_obj_attributes (ibfd)[OBJ_ATTR_GNU];
0b42f8
+  out_attrs = elf_known_obj_attributes (obfd)[OBJ_ATTR_GNU];
0b42f8
+
0b42f8
+  /* Check for conflicting Tag_GNU_S390_ABI_Vector attributes and
0b42f8
+     merge non-conflicting ones.  */
0b42f8
+  in_attr = &in_attrs[Tag_GNU_S390_ABI_Vector];
0b42f8
+  out_attr = &out_attrs[Tag_GNU_S390_ABI_Vector];
0b42f8
+
0b42f8
+  if (in_attr->i > 2)
0b42f8
+    _bfd_error_handler
0b42f8
+      (_("Warning: %B uses unknown vector ABI %d"), ibfd,
0b42f8
+       in_attr->i);
0b42f8
+  else if (out_attr->i > 2)
0b42f8
+    _bfd_error_handler
0b42f8
+      (_("Warning: %B uses unknown vector ABI %d"), obfd,
0b42f8
+       out_attr->i);
0b42f8
+  else if (in_attr->i != out_attr->i)
0b42f8
+    {
0b42f8
+      out_attr->type = ATTR_TYPE_FLAG_INT_VAL;
0b42f8
+
0b42f8
+      if (in_attr->i && out_attr->i)
0b42f8
+	{
0b42f8
+	  const char abi_str[3][9] = { "none", "software", "hardware" };
0b42f8
+
0b42f8
+	  _bfd_error_handler
0b42f8
+	    (_("Warning: %B uses vector %s ABI, %B uses %s ABI"),
0b42f8
+	     ibfd, obfd, abi_str[in_attr->i], abi_str[out_attr->i]);
0b42f8
+	}
0b42f8
+      if (in_attr->i > out_attr->i)
0b42f8
+	out_attr->i = in_attr->i;
0b42f8
+    }
0b42f8
+
0b42f8
+  /* Merge Tag_compatibility attributes and any common GNU ones.  */
0b42f8
+  _bfd_elf_merge_object_attributes (ibfd, obfd);
0b42f8
+
0b42f8
+  return TRUE;
0b42f8
+}
0b42f8
Index: gdb-7.6.1/bfd/elf32-s390.c
0b42f8
===================================================================
0b42f8
--- gdb-7.6.1.orig/bfd/elf32-s390.c	2016-02-21 22:12:48.165552665 +0100
0b42f8
+++ gdb-7.6.1/bfd/elf32-s390.c	2016-02-21 22:12:55.356638665 +0100
0b42f8
@@ -3938,9 +3938,18 @@
0b42f8
   return plt->vma + PLT_FIRST_ENTRY_SIZE + i * PLT_ENTRY_SIZE;
0b42f8
 }
0b42f8
 
0b42f8
+/* Merge backend specific data from an object file to the output
0b42f8
+   object file when linking.  */
0b42f8
+
0b42f8
 static bfd_boolean
0b42f8
 elf32_s390_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
0b42f8
 {
0b42f8
+  if (!is_s390_elf (ibfd) || !is_s390_elf (obfd))
0b42f8
+    return TRUE;
0b42f8
+
0b42f8
+  if (!elf_s390_merge_obj_attributes (ibfd, obfd))
0b42f8
+    return FALSE;
0b42f8
+
0b42f8
   elf_elfheader (obfd)->e_flags |= elf_elfheader (ibfd)->e_flags;
0b42f8
   return TRUE;
0b42f8
 }
0b42f8
Index: gdb-7.6.1/bfd/elf64-s390.c
0b42f8
===================================================================
0b42f8
--- gdb-7.6.1.orig/bfd/elf64-s390.c	2016-02-21 22:12:48.166552677 +0100
0b42f8
+++ gdb-7.6.1/bfd/elf64-s390.c	2016-02-21 22:12:55.356638665 +0100
0b42f8
@@ -3722,6 +3722,21 @@
0b42f8
   return plt->vma + PLT_FIRST_ENTRY_SIZE + i * PLT_ENTRY_SIZE;
0b42f8
 }
0b42f8
 
0b42f8
+/* Merge backend specific data from an object file to the output
0b42f8
+   object file when linking.  */
0b42f8
+
0b42f8
+static bfd_boolean
0b42f8
+elf64_s390_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
0b42f8
+{
0b42f8
+  if (!is_s390_elf (ibfd) || !is_s390_elf (obfd))
0b42f8
+    return TRUE;
0b42f8
+
0b42f8
+  if (!elf_s390_merge_obj_attributes (ibfd, obfd))
0b42f8
+    return FALSE;
0b42f8
+
0b42f8
+  return TRUE;
0b42f8
+}
0b42f8
+
0b42f8
 /* Why was the hash table entry size definition changed from
0b42f8
    ARCH_SIZE/8 to 4? This breaks the 64 bit dynamic linker and
0b42f8
    this is the only reason for the s390_elf64_size_info structure.  */
0b42f8
@@ -3780,7 +3795,8 @@
0b42f8
 #define bfd_elf64_bfd_is_local_label_name     elf_s390_is_local_label_name
0b42f8
 #define bfd_elf64_bfd_link_hash_table_create  elf_s390_link_hash_table_create
0b42f8
 #define bfd_elf64_bfd_reloc_type_lookup	      elf_s390_reloc_type_lookup
0b42f8
-#define bfd_elf64_bfd_reloc_name_lookup elf_s390_reloc_name_lookup
0b42f8
+#define bfd_elf64_bfd_reloc_name_lookup       elf_s390_reloc_name_lookup
0b42f8
+#define bfd_elf64_bfd_merge_private_bfd_data  elf64_s390_merge_private_bfd_data
0b42f8
 
0b42f8
 #define elf_backend_adjust_dynamic_symbol     elf_s390_adjust_dynamic_symbol
0b42f8
 #define elf_backend_check_relocs	      elf_s390_check_relocs
0b42f8
Index: gdb-7.6.1/include/elf/s390.h
0b42f8
===================================================================
0b42f8
--- gdb-7.6.1.orig/include/elf/s390.h	2016-02-21 22:12:48.166552677 +0100
0b42f8
+++ gdb-7.6.1/include/elf/s390.h	2016-02-21 22:12:55.356638665 +0100
0b42f8
@@ -129,6 +129,17 @@
0b42f8
     RELOC_NUMBER (R_390_GNU_VTENTRY, 251)
0b42f8
 END_RELOC_NUMBERS (R_390_max)
0b42f8
 
0b42f8
-#endif /* _ELF_390_H */
0b42f8
+/* Object attribute tags.  */
0b42f8
+enum
0b42f8
+{
0b42f8
+  /* 0-3 are generic. */
0b42f8
+  /* 4 is reserved for the FP ABI. */
0b42f8
 
0b42f8
+  /* Vector ABI:
0b42f8
+     0 = not affected by the vector ABI, or not tagged.
0b42f8
+     1 = software vector ABI being used
0b42f8
+     2 = hardware vector ABI being used.  */
0b42f8
+  Tag_GNU_S390_ABI_Vector = 8,
0b42f8
+};
0b42f8
 
0b42f8
+#endif /* _ELF_390_H */