From: "Joseph S. Myers" <joseph@codesourcery.com>
To: binutils@sourceware.org
Subject: C6X unknown attribute handling
Date: Thu, 04 Nov 2010 15:52:00 -0000 [thread overview]
Message-ID: <Pine.LNX.4.64.1011041552120.3062@digraph.polyomino.org.uk> (raw)
This patch, on top of my previous patch
<http://sourceware.org/ml/binutils/2010-11/msg00092.html>, implements
the C6000 EABI requirements for handling of unknown attributes. I'll
commit it once that previous patch is in.
bfd:
2010-11-04 Joseph Myers <joseph@codesourcery.com>
* elf32-tic6x.c (elf32_tic6x_obj_attrs_handle_unknown): New.
(elf32_tic6x_merge_attributes): Use
_bfd_elf_merge_unknown_attribute_low and
_bfd_elf_merge_unknown_attribute_list.
(elf_backend_obj_attrs_handle_unknown): Define.
ld/testsuite:
2010-11-04 Joseph Myers <joseph@codesourcery.com>
* ld-tic6x/attr-unknown-1.d, ld-tic6x/attr-unknown-1000-1.s,
ld-tic6x/attr-unknown-1000-2.s, ld-tic6x/attr-unknown-1024-1.s,
ld-tic6x/attr-unknown-2.d, ld-tic6x/attr-unknown-3.d,
ld-tic6x/attr-unknown-4.d, ld-tic6x/attr-unknown-5.d,
ld-tic6x/attr-unknown-54-1.s, ld-tic6x/attr-unknown-55-a.s,
ld-tic6x/attr-unknown-6.d, ld-tic6x/attr-unknown-7.d,
ld-tic6x/attr-unknown-71-a.s, ld-tic6x/attr-unknown-71-b.s: New
tests.
Index: bfd/elf32-tic6x.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-tic6x.c,v
retrieving revision 1.12
diff -u -p -r1.12 elf32-tic6x.c
--- bfd/elf32-tic6x.c 2 Nov 2010 14:36:34 -0000 1.12
+++ bfd/elf32-tic6x.c 4 Nov 2010 15:41:46 -0000
@@ -1679,6 +1679,26 @@ elf32_tic6x_obj_attrs_order (int num)
return num;
}
+static bfd_boolean
+elf32_tic6x_obj_attrs_handle_unknown (bfd *abfd, int tag)
+{
+ if ((tag & 127) < 64)
+ {
+ _bfd_error_handler
+ (_("%B: error: unknown mandatory EABI object attribute %d"),
+ abfd, tag);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+ else
+ {
+ _bfd_error_handler
+ (_("%B: warning: unknown EABI object attribute %d"),
+ abfd, tag);
+ return TRUE;
+ }
+}
+
/* Merge the Tag_ISA attribute values ARCH1 and ARCH2
and return the merged value. At present, all merges succeed, so no
return value for errors is defined. */
@@ -1938,7 +1958,13 @@ elf32_tic6x_merge_attributes (bfd *ibfd,
out_attr[i].s = NULL;
break;
+ case Tag_ABI_compatibility:
+ /* Merged in _bfd_elf_merge_object_attributes. */
+ break;
+
default:
+ result
+ = result && _bfd_elf_merge_unknown_attribute_low (ibfd, obfd, i);
break;
}
@@ -1950,6 +1976,8 @@ elf32_tic6x_merge_attributes (bfd *ibfd,
if (!_bfd_elf_merge_object_attributes (ibfd, obfd))
return FALSE;
+ result &= _bfd_elf_merge_unknown_attribute_list (ibfd, obfd);
+
return result;
}
@@ -1984,6 +2012,7 @@ elf32_tic6x_merge_private_bfd_data (bfd
#define elf_backend_may_use_rel_p 1
#define elf_backend_may_use_rela_p 1
#define elf_backend_obj_attrs_arg_type elf32_tic6x_obj_attrs_arg_type
+#define elf_backend_obj_attrs_handle_unknown elf32_tic6x_obj_attrs_handle_unknown
#define elf_backend_obj_attrs_order elf32_tic6x_obj_attrs_order
#define elf_backend_obj_attrs_section ".c6xabi.attributes"
#define elf_backend_obj_attrs_section_type SHT_C6000_ATTRIBUTES
Index: ld/testsuite/ld-tic6x/attr-unknown-1.d
===================================================================
RCS file: ld/testsuite/ld-tic6x/attr-unknown-1.d
diff -N ld/testsuite/ld-tic6x/attr-unknown-1.d
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-tic6x/attr-unknown-1.d 4 Nov 2010 15:41:46 -0000
@@ -0,0 +1,6 @@
+#name: C6X unknown attribute merging 1
+#as: -mlittle-endian
+#ld: -r -melf32_tic6x_le
+#source: attr-unknown-54-1.s
+#source: attr-unknown-54-1.s
+#error: .*error: unknown mandatory EABI object attribute 54
Index: ld/testsuite/ld-tic6x/attr-unknown-1000-1.s
===================================================================
RCS file: ld/testsuite/ld-tic6x/attr-unknown-1000-1.s
diff -N ld/testsuite/ld-tic6x/attr-unknown-1000-1.s
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-tic6x/attr-unknown-1000-1.s 4 Nov 2010 15:41:46 -0000
@@ -0,0 +1 @@
+.c6xabi_attribute 1000, 1
Index: ld/testsuite/ld-tic6x/attr-unknown-1000-2.s
===================================================================
RCS file: ld/testsuite/ld-tic6x/attr-unknown-1000-2.s
diff -N ld/testsuite/ld-tic6x/attr-unknown-1000-2.s
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-tic6x/attr-unknown-1000-2.s 4 Nov 2010 15:41:46 -0000
@@ -0,0 +1 @@
+.c6xabi_attribute 1000, 2
Index: ld/testsuite/ld-tic6x/attr-unknown-1024-1.s
===================================================================
RCS file: ld/testsuite/ld-tic6x/attr-unknown-1024-1.s
diff -N ld/testsuite/ld-tic6x/attr-unknown-1024-1.s
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-tic6x/attr-unknown-1024-1.s 4 Nov 2010 15:41:46 -0000
@@ -0,0 +1 @@
+.c6xabi_attribute 1024, 1
Index: ld/testsuite/ld-tic6x/attr-unknown-2.d
===================================================================
RCS file: ld/testsuite/ld-tic6x/attr-unknown-2.d
diff -N ld/testsuite/ld-tic6x/attr-unknown-2.d
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-tic6x/attr-unknown-2.d 4 Nov 2010 15:41:46 -0000
@@ -0,0 +1,6 @@
+#name: C6X unknown attribute merging 2
+#as: -mlittle-endian
+#ld: -r -melf32_tic6x_le
+#source: attr-unknown-55-a.s
+#source: attr-unknown-55-a.s
+#error: .*error: unknown mandatory EABI object attribute 55
Index: ld/testsuite/ld-tic6x/attr-unknown-3.d
===================================================================
RCS file: ld/testsuite/ld-tic6x/attr-unknown-3.d
diff -N ld/testsuite/ld-tic6x/attr-unknown-3.d
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-tic6x/attr-unknown-3.d 4 Nov 2010 15:41:46 -0000
@@ -0,0 +1,12 @@
+#name: C6X unknown attribute merging 3
+#as: -mlittle-endian
+#ld: -r -melf32_tic6x_le
+#source: attr-unknown-71-a.s
+#source: attr-unknown-71-a.s
+#warning: .*warning: unknown EABI object attribute 71
+#readelf: -A
+
+Attribute Section: c6xabi
+File Attributes
+ Tag_ISA: C674x
+ Tag_unknown_71: "a"
Index: ld/testsuite/ld-tic6x/attr-unknown-4.d
===================================================================
RCS file: ld/testsuite/ld-tic6x/attr-unknown-4.d
diff -N ld/testsuite/ld-tic6x/attr-unknown-4.d
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-tic6x/attr-unknown-4.d 4 Nov 2010 15:41:46 -0000
@@ -0,0 +1,11 @@
+#name: C6X unknown attribute merging 4
+#as: -mlittle-endian
+#ld: -r -melf32_tic6x_le
+#source: attr-unknown-71-a.s
+#source: attr-unknown-71-b.s
+#warning: .*warning: unknown EABI object attribute 71
+#readelf: -A
+
+Attribute Section: c6xabi
+File Attributes
+ Tag_ISA: C674x
Index: ld/testsuite/ld-tic6x/attr-unknown-5.d
===================================================================
RCS file: ld/testsuite/ld-tic6x/attr-unknown-5.d
diff -N ld/testsuite/ld-tic6x/attr-unknown-5.d
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-tic6x/attr-unknown-5.d 4 Nov 2010 15:41:46 -0000
@@ -0,0 +1,12 @@
+#name: C6X unknown attribute merging 5
+#as: -mlittle-endian
+#ld: -r -melf32_tic6x_le
+#source: attr-unknown-1000-1.s
+#source: attr-unknown-1000-1.s
+#warning: .*warning: unknown EABI object attribute 1000
+#readelf: -A
+
+Attribute Section: c6xabi
+File Attributes
+ Tag_ISA: C674x
+ Tag_unknown_1000: 1 \(0x1\)
Index: ld/testsuite/ld-tic6x/attr-unknown-54-1.s
===================================================================
RCS file: ld/testsuite/ld-tic6x/attr-unknown-54-1.s
diff -N ld/testsuite/ld-tic6x/attr-unknown-54-1.s
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-tic6x/attr-unknown-54-1.s 4 Nov 2010 15:41:46 -0000
@@ -0,0 +1 @@
+.c6xabi_attribute 54, 1
Index: ld/testsuite/ld-tic6x/attr-unknown-55-a.s
===================================================================
RCS file: ld/testsuite/ld-tic6x/attr-unknown-55-a.s
diff -N ld/testsuite/ld-tic6x/attr-unknown-55-a.s
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-tic6x/attr-unknown-55-a.s 4 Nov 2010 15:41:46 -0000
@@ -0,0 +1 @@
+.c6xabi_attribute 55, "a"
Index: ld/testsuite/ld-tic6x/attr-unknown-6.d
===================================================================
RCS file: ld/testsuite/ld-tic6x/attr-unknown-6.d
diff -N ld/testsuite/ld-tic6x/attr-unknown-6.d
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-tic6x/attr-unknown-6.d 4 Nov 2010 15:41:46 -0000
@@ -0,0 +1,11 @@
+#name: C6X unknown attribute merging 6
+#as: -mlittle-endian
+#ld: -r -melf32_tic6x_le
+#source: attr-unknown-1000-1.s
+#source: attr-unknown-1000-2.s
+#warning: .*warning: unknown EABI object attribute 1000
+#readelf: -A
+
+Attribute Section: c6xabi
+File Attributes
+ Tag_ISA: C674x
Index: ld/testsuite/ld-tic6x/attr-unknown-7.d
===================================================================
RCS file: ld/testsuite/ld-tic6x/attr-unknown-7.d
diff -N ld/testsuite/ld-tic6x/attr-unknown-7.d
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-tic6x/attr-unknown-7.d 4 Nov 2010 15:41:46 -0000
@@ -0,0 +1,6 @@
+#name: C6X unknown attribute merging 7
+#as: -mlittle-endian
+#ld: -r -melf32_tic6x_le
+#source: attr-unknown-1024-1.s
+#source: attr-unknown-1024-1.s
+#error: .*error: unknown mandatory EABI object attribute 1024
Index: ld/testsuite/ld-tic6x/attr-unknown-71-a.s
===================================================================
RCS file: ld/testsuite/ld-tic6x/attr-unknown-71-a.s
diff -N ld/testsuite/ld-tic6x/attr-unknown-71-a.s
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-tic6x/attr-unknown-71-a.s 4 Nov 2010 15:41:46 -0000
@@ -0,0 +1 @@
+.c6xabi_attribute 71, "a"
Index: ld/testsuite/ld-tic6x/attr-unknown-71-b.s
===================================================================
RCS file: ld/testsuite/ld-tic6x/attr-unknown-71-b.s
diff -N ld/testsuite/ld-tic6x/attr-unknown-71-b.s
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-tic6x/attr-unknown-71-b.s 4 Nov 2010 15:41:46 -0000
@@ -0,0 +1 @@
+.c6xabi_attribute 71, "b"
--
Joseph S. Myers
joseph@codesourcery.com
reply other threads:[~2010-11-04 15:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.1011041552120.3062@digraph.polyomino.org.uk \
--to=joseph@codesourcery.com \
--cc=binutils@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).