This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C6X compatibility attribute


I've applied this patch to add support for the C6X Tag_ABI_compatibility 
attribute.  This was previously supported in the generic Tag_compatibility 
form - now the C6X ABI defines it with the same value, but the name 
Tag_ABI_compatibility, and so the support is updated accordingly, some 
bugs fixed and testcases added.

Note: I'm not convinced the generic support is correct for any of ARM, C6X 
or generic GNU attributes (all of which are meant to have the same 
semantics for this attributes).  As far as I can see, 0, "" should merge 
OK with 1, "gnu" - the former means conforming object, the latter means 
conforming as long as processed with GNU binutils, and the combination 
should result in 1, "gnu".  But the present code rejects this combination.

bfd:
2010-10-29  Joseph Myers  <joseph@codesourcery.com>

	* elf32-tic6x.c (elf32_tic6x_obj_attrs_arg_type): Check
	Tag_ABI_compatibility not Tag_compatibility.
	(elf32_tic6x_merge_attributes): Update compatibility attribute
	name in comment.  Return FALSE if merging common attributes fails.

binutils:
2010-10-29  Joseph Myers  <joseph@codesourcery.com>

	* readelf.c (display_tic6x_attribute): Use Tag_ABI_compatibility
	not hardcoded 32.  Display name of this attribute.

gas:
2010-10-29  Joseph Myers  <joseph@codesourcery.com>

	* doc/c-tic6x.texi (TIC6X Directives): Mention
	Tag_ABI_compatibility.

gas/testsuite:
2010-10-29  Joseph Myers  <joseph@codesourcery.com>

	* gas/tic6x/attr-compatibility-directive-1.d,
	gas/tic6x/attr-compatibility-directive-1.s,
	gas/tic6x/attr-compatibility-directive-2.d,
	gas/tic6x/attr-compatibility-directive-2.s: New tests.

include/elf:
2010-10-29  Joseph Myers  <joseph@codesourcery.com>

	* tic6x-attrs.h (Tag_ABI_compatibility): Define.

ld/testsuite:
2010-10-29  Joseph Myers  <joseph@codesourcery.com>

	* ld-tic6x/attr-compatibility-gnu-gnu.d,
	ld-tic6x/attr-compatibility-gnu-other.d,
	ld-tic6x/attr-compatibility-gnu.s,
	ld-tic6x/attr-compatibility-other-gnu.d,
	ld-tic6x/attr-compatibility-other-other.d,
	ld-tic6x/attr-compatibility-other.s: New tests.

Index: bfd/elf32-tic6x.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-tic6x.c,v
retrieving revision 1.10
diff -u -p -r1.10 elf32-tic6x.c
--- bfd/elf32-tic6x.c	29 Oct 2010 00:15:51 -0000	1.10
+++ bfd/elf32-tic6x.c	29 Oct 2010 16:39:05 -0000
@@ -1661,7 +1661,7 @@ elf32_tic6x_relocate_section (bfd *outpu
 static int
 elf32_tic6x_obj_attrs_arg_type (int tag)
 {
-  if (tag == Tag_compatibility)
+  if (tag == Tag_ABI_compatibility)
     return ATTR_TYPE_FLAG_INT_VAL | ATTR_TYPE_FLAG_STR_VAL;
   else
     /* Correct for known attributes, arbitrary for others.  */
@@ -1729,8 +1729,9 @@ elf32_tic6x_merge_attributes (bfd *ibfd,
 	(_("warning: %B and %B differ in whether code is compiled for DSBT"),
 	 obfd, ibfd);
     }
-  /* Merge Tag_compatibility attributes and any common GNU ones.  */
-  _bfd_elf_merge_object_attributes (ibfd, obfd);
+  /* Merge Tag_ABI_compatibility attributes and any common GNU ones.  */
+  if (!_bfd_elf_merge_object_attributes (ibfd, obfd))
+    return FALSE;
 
   return TRUE;
 }
Index: binutils/readelf.c
===================================================================
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.520
diff -u -p -r1.520 readelf.c
--- binutils/readelf.c	29 Oct 2010 12:10:31 -0000	1.520
+++ binutils/readelf.c	29 Oct 2010 16:39:06 -0000
@@ -10822,11 +10822,10 @@ display_tic6x_attribute (unsigned char *
 	}
       return p;
 
-    case 32:
-      /* Tag_compatibility - treated as generic by binutils for now
-	 although not currently specified for C6X.  */
+    case Tag_ABI_compatibility:
       val = read_uleb128 (p, &len);
       p += len;
+      printf ("  Tag_ABI_compatibility: ");
       printf (_("flag = %d, vendor = %s\n"), val, p);
       p += strlen ((char *) p) + 1;
       return p;
Index: gas/doc/c-tic6x.texi
===================================================================
RCS file: /cvs/src/src/gas/doc/c-tic6x.texi,v
retrieving revision 1.4
diff -u -p -r1.4 c-tic6x.texi
--- gas/doc/c-tic6x.texi	29 Oct 2010 00:15:53 -0000	1.4
+++ gas/doc/c-tic6x.texi	29 Oct 2010 16:39:07 -0000
@@ -125,7 +125,7 @@ These have the same effects as @option{-
 Set the C6000 EABI build attribute @var{tag} to @var{value}.
 
 The @var{tag} is either an attribute number or one of
-@code{Tag_ISA} or @code{Tag_ABI_DSBT}.  The
+@code{Tag_ISA}, @code{Tag_ABI_DSBT} and @code{Tag_ABI_compatibility}.  The
 @var{value} is either a @code{number}, @code{"string"}, or
 @code{number, "string"} depending on the tag.
 
Index: gas/testsuite/gas/tic6x/attr-compatibility-directive-1.d
===================================================================
RCS file: gas/testsuite/gas/tic6x/attr-compatibility-directive-1.d
diff -N gas/testsuite/gas/tic6x/attr-compatibility-directive-1.d
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/tic6x/attr-compatibility-directive-1.d	29 Oct 2010 16:39:07 -0000
@@ -0,0 +1,9 @@
+#readelf: -A
+#name: C6X compatibility attribute, directives 1
+#as:
+#source: attr-compatibility-directive-1.s
+
+Attribute Section: c6xabi
+File Attributes
+  Tag_ISA: C674x
+  Tag_ABI_compatibility: flag = 1, vendor = gnu
Index: gas/testsuite/gas/tic6x/attr-compatibility-directive-1.s
===================================================================
RCS file: gas/testsuite/gas/tic6x/attr-compatibility-directive-1.s
diff -N gas/testsuite/gas/tic6x/attr-compatibility-directive-1.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/tic6x/attr-compatibility-directive-1.s	29 Oct 2010 16:39:07 -0000
@@ -0,0 +1 @@
+.c6xabi_attribute Tag_ABI_compatibility, 1, "gnu"
Index: gas/testsuite/gas/tic6x/attr-compatibility-directive-2.d
===================================================================
RCS file: gas/testsuite/gas/tic6x/attr-compatibility-directive-2.d
diff -N gas/testsuite/gas/tic6x/attr-compatibility-directive-2.d
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/tic6x/attr-compatibility-directive-2.d	29 Oct 2010 16:39:07 -0000
@@ -0,0 +1,9 @@
+#readelf: -A
+#name: C6X compatibility attribute, directives 2
+#as:
+#source: attr-compatibility-directive-2.s
+
+Attribute Section: c6xabi
+File Attributes
+  Tag_ISA: C674x
+  Tag_ABI_compatibility: flag = 1, vendor = gnu
Index: gas/testsuite/gas/tic6x/attr-compatibility-directive-2.s
===================================================================
RCS file: gas/testsuite/gas/tic6x/attr-compatibility-directive-2.s
diff -N gas/testsuite/gas/tic6x/attr-compatibility-directive-2.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/tic6x/attr-compatibility-directive-2.s	29 Oct 2010 16:39:07 -0000
@@ -0,0 +1 @@
+.c6xabi_attribute 32, 1, "gnu"
Index: include/elf/tic6x-attrs.h
===================================================================
RCS file: /cvs/src/src/include/elf/tic6x-attrs.h,v
retrieving revision 1.3
diff -u -p -r1.3 tic6x-attrs.h
--- include/elf/tic6x-attrs.h	29 Oct 2010 00:15:56 -0000	1.3
+++ include/elf/tic6x-attrs.h	29 Oct 2010 16:39:07 -0000
@@ -24,3 +24,4 @@
 
 TAG(Tag_ISA, 4)
 TAG(Tag_ABI_DSBT, 12)
+TAG(Tag_ABI_compatibility, 32)
Index: ld/testsuite/ld-tic6x/attr-compatibility-gnu-gnu.d
===================================================================
RCS file: ld/testsuite/ld-tic6x/attr-compatibility-gnu-gnu.d
diff -N ld/testsuite/ld-tic6x/attr-compatibility-gnu-gnu.d
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-tic6x/attr-compatibility-gnu-gnu.d	29 Oct 2010 16:39:07 -0000
@@ -0,0 +1,11 @@
+#name: C6X compatibility attribute merging, gnu gnu
+#as: -mlittle-endian
+#ld: -r -melf32_tic6x_le
+#source: attr-compatibility-gnu.s
+#source: attr-compatibility-gnu.s
+#readelf: -A
+
+Attribute Section: c6xabi
+File Attributes
+  Tag_ISA: C674x
+  Tag_ABI_compatibility: flag = 1, vendor = gnu
Index: ld/testsuite/ld-tic6x/attr-compatibility-gnu-other.d
===================================================================
RCS file: ld/testsuite/ld-tic6x/attr-compatibility-gnu-other.d
diff -N ld/testsuite/ld-tic6x/attr-compatibility-gnu-other.d
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-tic6x/attr-compatibility-gnu-other.d	29 Oct 2010 16:39:07 -0000
@@ -0,0 +1,6 @@
+#name: C6X compatibility attribute merging, gnu other
+#as: -mlittle-endian
+#ld: -r -melf32_tic6x_le
+#source: attr-compatibility-gnu.s
+#source: attr-compatibility-other.s
+#error: .*Object has vendor-specific contents that must be processed by the 'other' toolchain
Index: ld/testsuite/ld-tic6x/attr-compatibility-gnu.s
===================================================================
RCS file: ld/testsuite/ld-tic6x/attr-compatibility-gnu.s
diff -N ld/testsuite/ld-tic6x/attr-compatibility-gnu.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-tic6x/attr-compatibility-gnu.s	29 Oct 2010 16:39:07 -0000
@@ -0,0 +1 @@
+.c6xabi_attribute Tag_ABI_compatibility, 1, "gnu"
Index: ld/testsuite/ld-tic6x/attr-compatibility-other-gnu.d
===================================================================
RCS file: ld/testsuite/ld-tic6x/attr-compatibility-other-gnu.d
diff -N ld/testsuite/ld-tic6x/attr-compatibility-other-gnu.d
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-tic6x/attr-compatibility-other-gnu.d	29 Oct 2010 16:39:07 -0000
@@ -0,0 +1,6 @@
+#name: C6X compatibility attribute merging, other gnu
+#as: -mlittle-endian
+#ld: -r -melf32_tic6x_le
+#source: attr-compatibility-other.s
+#source: attr-compatibility-gnu.s
+#error: .*Object tag '1, gnu' is incompatible with tag '1, other'
Index: ld/testsuite/ld-tic6x/attr-compatibility-other-other.d
===================================================================
RCS file: ld/testsuite/ld-tic6x/attr-compatibility-other-other.d
diff -N ld/testsuite/ld-tic6x/attr-compatibility-other-other.d
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-tic6x/attr-compatibility-other-other.d	29 Oct 2010 16:39:07 -0000
@@ -0,0 +1,6 @@
+#name: C6X compatibility attribute merging, other other
+#as: -mlittle-endian
+#ld: -r -melf32_tic6x_le
+#source: attr-compatibility-other.s
+#source: attr-compatibility-other.s
+#error: .*Object has vendor-specific contents that must be processed by the 'other' toolchain
Index: ld/testsuite/ld-tic6x/attr-compatibility-other.s
===================================================================
RCS file: ld/testsuite/ld-tic6x/attr-compatibility-other.s
diff -N ld/testsuite/ld-tic6x/attr-compatibility-other.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-tic6x/attr-compatibility-other.s	29 Oct 2010 16:39:07 -0000
@@ -0,0 +1 @@
+.c6xabi_attribute Tag_ABI_compatibility, 1, "other"

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]