From 0547accfd9f48d2ee708b5b37c7f909d590dfcdd Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Fri, 5 Nov 2010 13:04:07 +0000 Subject: [PATCH] bfd: * 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: * 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. --- bfd/ChangeLog | 8 ++++++ bfd/elf32-tic6x.c | 29 +++++++++++++++++++++ ld/testsuite/ChangeLog | 11 ++++++++ ld/testsuite/ld-tic6x/attr-unknown-1.d | 6 +++++ ld/testsuite/ld-tic6x/attr-unknown-1000-1.s | 1 + ld/testsuite/ld-tic6x/attr-unknown-1000-2.s | 1 + ld/testsuite/ld-tic6x/attr-unknown-1024-1.s | 1 + ld/testsuite/ld-tic6x/attr-unknown-2.d | 6 +++++ ld/testsuite/ld-tic6x/attr-unknown-3.d | 12 +++++++++ ld/testsuite/ld-tic6x/attr-unknown-4.d | 11 ++++++++ ld/testsuite/ld-tic6x/attr-unknown-5.d | 12 +++++++++ ld/testsuite/ld-tic6x/attr-unknown-54-1.s | 1 + ld/testsuite/ld-tic6x/attr-unknown-55-a.s | 1 + ld/testsuite/ld-tic6x/attr-unknown-6.d | 11 ++++++++ ld/testsuite/ld-tic6x/attr-unknown-7.d | 6 +++++ ld/testsuite/ld-tic6x/attr-unknown-71-a.s | 1 + ld/testsuite/ld-tic6x/attr-unknown-71-b.s | 1 + 17 files changed, 119 insertions(+) create mode 100644 ld/testsuite/ld-tic6x/attr-unknown-1.d create mode 100644 ld/testsuite/ld-tic6x/attr-unknown-1000-1.s create mode 100644 ld/testsuite/ld-tic6x/attr-unknown-1000-2.s create mode 100644 ld/testsuite/ld-tic6x/attr-unknown-1024-1.s create mode 100644 ld/testsuite/ld-tic6x/attr-unknown-2.d create mode 100644 ld/testsuite/ld-tic6x/attr-unknown-3.d create mode 100644 ld/testsuite/ld-tic6x/attr-unknown-4.d create mode 100644 ld/testsuite/ld-tic6x/attr-unknown-5.d create mode 100644 ld/testsuite/ld-tic6x/attr-unknown-54-1.s create mode 100644 ld/testsuite/ld-tic6x/attr-unknown-55-a.s create mode 100644 ld/testsuite/ld-tic6x/attr-unknown-6.d create mode 100644 ld/testsuite/ld-tic6x/attr-unknown-7.d create mode 100644 ld/testsuite/ld-tic6x/attr-unknown-71-a.s create mode 100644 ld/testsuite/ld-tic6x/attr-unknown-71-b.s diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 22dd1909ab..78b904af7c 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,11 @@ +2010-11-05 Joseph Myers + + * 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. + 2010-11-05 Joseph Myers * elf-attrs.c (_bfd_elf_merge_unknown_attribute_low, diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c index 4e91d7497d..3674a3a8ad 100644 --- a/bfd/elf32-tic6x.c +++ b/bfd/elf32-tic6x.c @@ -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, bfd *obfd) 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, bfd *obfd) 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 *ibfd, bfd *obfd) #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 diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 8da742a80e..e5b1623097 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2010-11-05 Joseph Myers + + * 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. + 2010-11-05 Dave Korn * ld-plugin/plugin.exp (testobjfiles): Dont use HOSTING_CRT0. diff --git a/ld/testsuite/ld-tic6x/attr-unknown-1.d b/ld/testsuite/ld-tic6x/attr-unknown-1.d new file mode 100644 index 0000000000..e2b8f4542a --- /dev/null +++ b/ld/testsuite/ld-tic6x/attr-unknown-1.d @@ -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 diff --git a/ld/testsuite/ld-tic6x/attr-unknown-1000-1.s b/ld/testsuite/ld-tic6x/attr-unknown-1000-1.s new file mode 100644 index 0000000000..bb173452d6 --- /dev/null +++ b/ld/testsuite/ld-tic6x/attr-unknown-1000-1.s @@ -0,0 +1 @@ +.c6xabi_attribute 1000, 1 diff --git a/ld/testsuite/ld-tic6x/attr-unknown-1000-2.s b/ld/testsuite/ld-tic6x/attr-unknown-1000-2.s new file mode 100644 index 0000000000..658868be3c --- /dev/null +++ b/ld/testsuite/ld-tic6x/attr-unknown-1000-2.s @@ -0,0 +1 @@ +.c6xabi_attribute 1000, 2 diff --git a/ld/testsuite/ld-tic6x/attr-unknown-1024-1.s b/ld/testsuite/ld-tic6x/attr-unknown-1024-1.s new file mode 100644 index 0000000000..e2d7e4f411 --- /dev/null +++ b/ld/testsuite/ld-tic6x/attr-unknown-1024-1.s @@ -0,0 +1 @@ +.c6xabi_attribute 1024, 1 diff --git a/ld/testsuite/ld-tic6x/attr-unknown-2.d b/ld/testsuite/ld-tic6x/attr-unknown-2.d new file mode 100644 index 0000000000..8062a9a179 --- /dev/null +++ b/ld/testsuite/ld-tic6x/attr-unknown-2.d @@ -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 diff --git a/ld/testsuite/ld-tic6x/attr-unknown-3.d b/ld/testsuite/ld-tic6x/attr-unknown-3.d new file mode 100644 index 0000000000..ed7acdcf19 --- /dev/null +++ b/ld/testsuite/ld-tic6x/attr-unknown-3.d @@ -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" diff --git a/ld/testsuite/ld-tic6x/attr-unknown-4.d b/ld/testsuite/ld-tic6x/attr-unknown-4.d new file mode 100644 index 0000000000..dd165d67df --- /dev/null +++ b/ld/testsuite/ld-tic6x/attr-unknown-4.d @@ -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 diff --git a/ld/testsuite/ld-tic6x/attr-unknown-5.d b/ld/testsuite/ld-tic6x/attr-unknown-5.d new file mode 100644 index 0000000000..5a17b9a68a --- /dev/null +++ b/ld/testsuite/ld-tic6x/attr-unknown-5.d @@ -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\) diff --git a/ld/testsuite/ld-tic6x/attr-unknown-54-1.s b/ld/testsuite/ld-tic6x/attr-unknown-54-1.s new file mode 100644 index 0000000000..8f0600ef0e --- /dev/null +++ b/ld/testsuite/ld-tic6x/attr-unknown-54-1.s @@ -0,0 +1 @@ +.c6xabi_attribute 54, 1 diff --git a/ld/testsuite/ld-tic6x/attr-unknown-55-a.s b/ld/testsuite/ld-tic6x/attr-unknown-55-a.s new file mode 100644 index 0000000000..7b09d2b606 --- /dev/null +++ b/ld/testsuite/ld-tic6x/attr-unknown-55-a.s @@ -0,0 +1 @@ +.c6xabi_attribute 55, "a" diff --git a/ld/testsuite/ld-tic6x/attr-unknown-6.d b/ld/testsuite/ld-tic6x/attr-unknown-6.d new file mode 100644 index 0000000000..6509693714 --- /dev/null +++ b/ld/testsuite/ld-tic6x/attr-unknown-6.d @@ -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 diff --git a/ld/testsuite/ld-tic6x/attr-unknown-7.d b/ld/testsuite/ld-tic6x/attr-unknown-7.d new file mode 100644 index 0000000000..79ab8c5e69 --- /dev/null +++ b/ld/testsuite/ld-tic6x/attr-unknown-7.d @@ -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 diff --git a/ld/testsuite/ld-tic6x/attr-unknown-71-a.s b/ld/testsuite/ld-tic6x/attr-unknown-71-a.s new file mode 100644 index 0000000000..b7bf77e3ee --- /dev/null +++ b/ld/testsuite/ld-tic6x/attr-unknown-71-a.s @@ -0,0 +1 @@ +.c6xabi_attribute 71, "a" diff --git a/ld/testsuite/ld-tic6x/attr-unknown-71-b.s b/ld/testsuite/ld-tic6x/attr-unknown-71-b.s new file mode 100644 index 0000000000..de0f18bcce --- /dev/null +++ b/ld/testsuite/ld-tic6x/attr-unknown-71-b.s @@ -0,0 +1 @@ +.c6xabi_attribute 71, "b"