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

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