aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/elf-s390-common.c58
-rw-r--r--bfd/elf32-s390.c9
-rw-r--r--bfd/elf64-s390.c18
4 files changed, 91 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 367b5ec..2b4b32f 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2015-04-27 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
+
+ * elf-s390-common.c (elf_s390_merge_obj_attributes): New function.
+ * elf32-s390.c (elf32_s390_merge_private_bfd_data): Call
+ elf_s390_merge_obj_attributes.
+ * elf64-s390.c (elf64_s390_merge_private_bfd_data): New function.
+
2015-04-24 Jiong Wang <jiong.wang@arm.com>
PR ld/18270
diff --git a/bfd/elf-s390-common.c b/bfd/elf-s390-common.c
index 462da16..dc6f55b 100644
--- a/bfd/elf-s390-common.c
+++ b/bfd/elf-s390-common.c
@@ -254,3 +254,61 @@ elf_s390_elf_sort_relocs_p (asection *sec)
{
return (sec->flags & SEC_CODE) == 0;
}
+
+/* Merge object attributes from IBFD into OBFD. Raise an error if
+ there are conflicting attributes. */
+static bfd_boolean
+elf_s390_merge_obj_attributes (bfd *ibfd, bfd *obfd)
+{
+ obj_attribute *in_attr, *in_attrs;
+ obj_attribute *out_attr, *out_attrs;
+
+ if (!elf_known_obj_attributes_proc (obfd)[0].i)
+ {
+ /* This is the first object. Copy the attributes. */
+ _bfd_elf_copy_obj_attributes (ibfd, obfd);
+
+ /* Use the Tag_null value to indicate the attributes have been
+ initialized. */
+ elf_known_obj_attributes_proc (obfd)[0].i = 1;
+
+ return TRUE;
+ }
+
+ in_attrs = elf_known_obj_attributes (ibfd)[OBJ_ATTR_GNU];
+ out_attrs = elf_known_obj_attributes (obfd)[OBJ_ATTR_GNU];
+
+ /* Check for conflicting Tag_GNU_S390_ABI_Vector attributes and
+ merge non-conflicting ones. */
+ in_attr = &in_attrs[Tag_GNU_S390_ABI_Vector];
+ out_attr = &out_attrs[Tag_GNU_S390_ABI_Vector];
+
+ if (in_attr->i > 2)
+ _bfd_error_handler
+ (_("Warning: %B uses unknown vector ABI %d"), ibfd,
+ in_attr->i);
+ else if (out_attr->i > 2)
+ _bfd_error_handler
+ (_("Warning: %B uses unknown vector ABI %d"), obfd,
+ out_attr->i);
+ else if (in_attr->i != out_attr->i)
+ {
+ out_attr->type = ATTR_TYPE_FLAG_INT_VAL;
+
+ if (in_attr->i && out_attr->i)
+ {
+ const char abi_str[3][9] = { "none", "software", "hardware" };
+
+ _bfd_error_handler
+ (_("Warning: %B uses vector %s ABI, %B uses %s ABI"),
+ ibfd, obfd, abi_str[in_attr->i], abi_str[out_attr->i]);
+ }
+ if (in_attr->i > out_attr->i)
+ out_attr->i = in_attr->i;
+ }
+
+ /* Merge Tag_compatibility attributes and any common GNU ones. */
+ _bfd_elf_merge_object_attributes (ibfd, obfd);
+
+ return TRUE;
+}
diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c
index 0127eab..19ba044 100644
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -3980,9 +3980,18 @@ elf_s390_plt_sym_val (bfd_vma i, const asection *plt,
return plt->vma + PLT_FIRST_ENTRY_SIZE + i * PLT_ENTRY_SIZE;
}
+/* Merge backend specific data from an object file to the output
+ object file when linking. */
+
static bfd_boolean
elf32_s390_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
{
+ if (!is_s390_elf (ibfd) || !is_s390_elf (obfd))
+ return TRUE;
+
+ if (!elf_s390_merge_obj_attributes (ibfd, obfd))
+ return FALSE;
+
elf_elfheader (obfd)->e_flags |= elf_elfheader (ibfd)->e_flags;
return TRUE;
}
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index f06b58a..c9db954 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -3766,6 +3766,21 @@ elf_s390_plt_sym_val (bfd_vma i, const asection *plt,
return plt->vma + PLT_FIRST_ENTRY_SIZE + i * PLT_ENTRY_SIZE;
}
+/* Merge backend specific data from an object file to the output
+ object file when linking. */
+
+static bfd_boolean
+elf64_s390_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
+{
+ if (!is_s390_elf (ibfd) || !is_s390_elf (obfd))
+ return TRUE;
+
+ if (!elf_s390_merge_obj_attributes (ibfd, obfd))
+ return FALSE;
+
+ return TRUE;
+}
+
/* Why was the hash table entry size definition changed from
ARCH_SIZE/8 to 4? This breaks the 64 bit dynamic linker and
this is the only reason for the s390_elf64_size_info structure. */
@@ -3824,7 +3839,8 @@ const struct elf_size_info s390_elf64_size_info =
#define bfd_elf64_bfd_is_local_label_name elf_s390_is_local_label_name
#define bfd_elf64_bfd_link_hash_table_create elf_s390_link_hash_table_create
#define bfd_elf64_bfd_reloc_type_lookup elf_s390_reloc_type_lookup
-#define bfd_elf64_bfd_reloc_name_lookup elf_s390_reloc_name_lookup
+#define bfd_elf64_bfd_reloc_name_lookup elf_s390_reloc_name_lookup
+#define bfd_elf64_bfd_merge_private_bfd_data elf64_s390_merge_private_bfd_data
#define elf_backend_adjust_dynamic_symbol elf_s390_adjust_dynamic_symbol
#define elf_backend_check_relocs elf_s390_check_relocs