Skip to content

Commit b3a1e48

Browse files
author
Christophe Lyon
committed
arm: Make 'conflicting CPU architectures' error message more user-friendly
Error messages such as "conflicting CPU architectures 10/16" are not very to understand, so this patch replaces the numbers with the description they actually mean: "conflicting CPU architectures ARM v7E-M vs Pre v4" 2023-09-01 Christophe Lyon <[email protected]> bfd/ * elf32-arm.c (tag_cpu_arch_combine): Add name_table parameter and use it. (elf32_arm_merge_eabi_attributes): Update call to tag_cpu_arch_combine. ld/ * testsuite/ld-arm/attr-merge-9.out: Update expected error message. * testsuite/ld-arm/attr-merge-arch-2.d: Likewise.
1 parent 1b9a9c3 commit b3a1e48

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

bfd/elf32-arm.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14119,7 +14119,7 @@ set_secondary_compatible_arch (bfd *abfd, int arch)
1411914119

1412014120
static int
1412114121
tag_cpu_arch_combine (bfd *ibfd, int oldtag, int *secondary_compat_out,
14122-
int newtag, int secondary_compat)
14122+
int newtag, int secondary_compat, const char* name_table[])
1412314123
{
1412414124
#define T(X) TAG_CPU_ARCH_##X
1412514125
int tagl, tagh, result;
@@ -14436,8 +14436,8 @@ tag_cpu_arch_combine (bfd *ibfd, int oldtag, int *secondary_compat_out,
1443614436

1443714437
if (result == -1)
1443814438
{
14439-
_bfd_error_handler (_("error: %pB: conflicting CPU architectures %d/%d"),
14440-
ibfd, oldtag, newtag);
14439+
_bfd_error_handler (_("error: conflicting CPU architectures %s vs %s in %pB"),
14440+
name_table[oldtag], name_table[newtag], ibfd);
1444114441
return -1;
1444214442
}
1444314443

@@ -14632,7 +14632,8 @@ elf32_arm_merge_eabi_attributes (bfd *ibfd, struct bfd_link_info *info)
1463214632
arch_attr = tag_cpu_arch_combine (ibfd, out_attr[i].i,
1463314633
&secondary_compat_out,
1463414634
in_attr[i].i,
14635-
secondary_compat);
14635+
secondary_compat,
14636+
name_table);
1463614637

1463714638
/* Return with error if failed to merge. */
1463814639
if (arch_attr == -1)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
.*: error: .*: conflicting CPU architectures 10/16
1+
.*: error: conflicting CPU architectures ARM v7 vs ARM v8-M.baseline in .*
22
.*: failed to merge target specific data of file tmpdir/attr-merge-9b.o

ld/testsuite/ld-arm/attr-merge-arch-2.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
#source: attr-merge-arch-2b.s
33
#as:
44
#ld: -e main
5-
#error: conflicting CPU architectures 13/0
5+
#error: conflicting CPU architectures ARM v7E-M vs Pre v4 in .*

0 commit comments

Comments
 (0)