aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf-s390-common.c
diff options
context:
space:
mode:
authorAndreas Krebbel <krebbel@linux.vnet.ibm.com>2015-04-27 10:32:23 +0200
committerAndreas Krebbel <krebbel@linux.vnet.ibm.com>2015-04-27 10:32:23 +0200
commit643f7afb0d7f63dcff873d3cbfd7ed3eaf94197f (patch)
tree4bff220a5e5372b4ab9ee2a33d6bf761dbf3248c /bfd/elf-s390-common.c
parent3b78cfe1033fafa6ca36c69cf8587c1bd96996ca (diff)
downloadgdb-643f7afb0d7f63dcff873d3cbfd7ed3eaf94197f.zip
gdb-643f7afb0d7f63dcff873d3cbfd7ed3eaf94197f.tar.gz
gdb-643f7afb0d7f63dcff873d3cbfd7ed3eaf94197f.tar.bz2
S/390: z13 use GNU attribute to indicate vector ABI
bfd/ * 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. binutils/ * readelf.c (display_s390_gnu_attribute): New function. (process_s390_specific): New function. (process_arch_specific): Call process_s390_specific. gas/ * doc/as.texinfo: Document Tag_GNU_S390_ABI_Vector. include/elf/ * s390.h: Define Tag_GNU_S390_ABI_Vector.
Diffstat (limited to 'bfd/elf-s390-common.c')
-rw-r--r--bfd/elf-s390-common.c58
1 files changed, 58 insertions, 0 deletions
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;
+}