aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-arc.c
diff options
context:
space:
mode:
authorclaziss <claziss@synopsys.com>2018-08-06 16:41:32 +0300
committerClaudiu Zissulescu <claziss@gmail.com>2018-08-06 16:41:32 +0300
commit2fd43d7870803bf0713f76118cc0fcb89407e873 (patch)
treeb04c7684d0f97fdc9bbba80cc6dc29bad0e64fdb /bfd/elf32-arc.c
parentdb1e1b45b417dc3e7d37f401828afa18328d8508 (diff)
downloadgdb-2fd43d7870803bf0713f76118cc0fcb89407e873.zip
gdb-2fd43d7870803bf0713f76118cc0fcb89407e873.tar.gz
gdb-2fd43d7870803bf0713f76118cc0fcb89407e873.tar.bz2
[ARC] Update merging attributes.
Some attributes were ignored during merging. Fix that, and add some errors. bfd/ 2017-09-19 Claudiu Zissulescu <claziss@synopsys.com> * elf32-arc.c (arc_elf_merge_attributes): Fix merge attributes. ld/ 2017-09-19 Claudiu Zissulescu <claziss@synopsys.com> * testsuite/ld-arc/attr-merge-6.d: New file. * testsuite/ld-arc/attr-merge-6a.s: Likewise. * testsuite/ld-arc/attr-merge-6b.s: Likewise. * testsuite/ld-arc/attr-merge-6bis.d: Likewise.
Diffstat (limited to 'bfd/elf32-arc.c')
-rw-r--r--bfd/elf32-arc.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
index aaa2c3b..25c9666 100644
--- a/bfd/elf32-arc.c
+++ b/bfd/elf32-arc.c
@@ -578,7 +578,6 @@ arc_elf_merge_attributes (bfd *ibfd, struct bfd_link_info *info)
bfd_boolean result = TRUE;
const char *sec_name = get_elf_backend_data (ibfd)->obj_attrs_section;
char *tagname = NULL;
- int offset = 0;
/* Skip the linker stubs file. This preserves previous behavior
of accepting unknown attributes in the first input file - but
@@ -732,7 +731,12 @@ arc_elf_merge_attributes (bfd *ibfd, struct bfd_link_info *info)
out_attr[i].i = in_attr[i].i;
break;
+ /* The CPU name is given by the vendor, just choose an
+ existing one if missing or different. There are no fail
+ criteria if they different or both missing. */
case Tag_ARC_CPU_name:
+ if (!out_attr[i].s && in_attr[i].s)
+ out_attr[i].s = _bfd_elf_attr_strdup (obfd, in_attr[i].s);
break;
case Tag_ARC_ABI_rf16:
@@ -764,7 +768,9 @@ arc_elf_merge_attributes (bfd *ibfd, struct bfd_link_info *info)
BFD_ASSERT (in_attr[i].i < 3);
BFD_ASSERT (out_attr[i].i < 3);
- if (out_attr[i].i != 0 && in_attr[i].i != 0
+ if (out_attr[i].i == 0)
+ out_attr[i].i = in_attr[i].i;
+ else if (out_attr[i].i != 0 && in_attr[i].i != 0
&& out_attr[i].i != in_attr[i].i)
{
_bfd_error_handler
@@ -789,7 +795,9 @@ arc_elf_merge_attributes (bfd *ibfd, struct bfd_link_info *info)
if (!tagname)
tagname = "ABI exceptions";
- if (out_attr[i].i != 0 && in_attr[i].i != 0
+ if (out_attr[i].i == 0)
+ out_attr[i].i = in_attr[i].i;
+ else if (out_attr[i].i != 0 && in_attr[i].i != 0
&& out_attr[i].i != in_attr[i].i)
{
_bfd_error_handler