[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.
This commit is contained in:
claziss 2018-08-06 16:41:32 +03:00 committed by Claudiu Zissulescu
parent db1e1b45b4
commit 2fd43d7870
7 changed files with 71 additions and 3 deletions

View File

@ -1,3 +1,7 @@
2018-08-06 Claudiu Zissulescu <claziss@synopsys.com>
* elf32-arc.c (arc_elf_merge_attributes): Fix merge attributes.
2018-08-06 Claudiu Zissulescu <claziss@synopsys.com>
* elf32-arc.c (arc_elf_merge_attributes): Handle

View File

@ -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

View File

@ -1,3 +1,10 @@
2018-08-06 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.
2018-08-06 Claudiu Zissulescu <claziss@synopsys.com>
* testsuite/ld-arc/attr-merge-0.d: Update test.

View File

@ -0,0 +1,16 @@
# source: attr-merge-6a.s
# source: attr-merge-6b.s
# as:
# ld: -r
# readelf: -A
Attribute Section: ARC
File Attributes
Tag_ARC_PCS_config: Bare metal/newlib
Tag_ARC_CPU_base: ARCEM
Tag_ARC_CPU_variation: Core2
Tag_ARC_CPU_name: "arcem"
Tag_ARC_ABI_osver: v4
Tag_ARC_ABI_sda: MWDT
Tag_ARC_ISA_config: "CD"
Tag_ARC_ATR_version: 1

View File

@ -0,0 +1,9 @@
# MWDT like attribute structure
.cpu EM
.arc_attribute Tag_ARC_ATR_version, 1
.arc_attribute Tag_ARC_ABI_sda, 1
.arc_attribute Tag_ARC_ABI_enumsize, 0
.arc_attribute Tag_ARC_CPU_variation, 1
.arc_attribute Tag_ARC_ISA_mpy_option, 0
.arc_attribute Tag_ARC_ABI_osver, 0
.arc_attribute Tag_ARC_CPU_name, ""

View File

@ -0,0 +1,8 @@
#GCC like attribute structure
.cpu EM
.arc_attribute Tag_ARC_PCS_config, 2
.arc_attribute Tag_ARC_CPU_variation, 2
.arc_attribute Tag_ARC_CPU_name, "arcem"
.arc_attribute Tag_ARC_ABI_osver, 4
.arc_attribute Tag_ARC_ISA_config, "CD"
.arc_attribute Tag_ARC_ATR_version, 1

View File

@ -0,0 +1,16 @@
# source: attr-merge-6b.s
# source: attr-merge-6a.s
# as:
# ld: -r
# readelf: -A
Attribute Section: ARC
File Attributes
Tag_ARC_PCS_config: Bare metal/newlib
Tag_ARC_CPU_base: ARCEM
Tag_ARC_CPU_variation: Core2
Tag_ARC_CPU_name: "arcem"
Tag_ARC_ABI_osver: v4
Tag_ARC_ABI_sda: MWDT
Tag_ARC_ISA_config: "CD"
Tag_ARC_ATR_version: 1