public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] arm: Make 'conflicting CPU architectures' error message more user-friendly
@ 2023-09-01 13:59 Christophe Lyon
  2023-09-04 12:19 ` Nick Clifton
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe Lyon @ 2023-09-01 13:59 UTC (permalink / raw)
  To: binutils, nickc, richard.earnshaw; +Cc: Christophe Lyon

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  <christophe.lyon@linaro.org>

	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.
---
 bfd/elf32-arm.c                         | 9 +++++----
 ld/testsuite/ld-arm/attr-merge-9.out    | 2 +-
 ld/testsuite/ld-arm/attr-merge-arch-2.d | 2 +-
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 3b7cee3de1c..f3ad270a6a0 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -14119,7 +14119,7 @@ set_secondary_compatible_arch (bfd *abfd, int arch)
 
 static int
 tag_cpu_arch_combine (bfd *ibfd, int oldtag, int *secondary_compat_out,
-		      int newtag, int secondary_compat)
+		      int newtag, int secondary_compat, const char* name_table[])
 {
 #define T(X) TAG_CPU_ARCH_##X
   int tagl, tagh, result;
@@ -14436,8 +14436,8 @@ tag_cpu_arch_combine (bfd *ibfd, int oldtag, int *secondary_compat_out,
 
   if (result == -1)
     {
-      _bfd_error_handler (_("error: %pB: conflicting CPU architectures %d/%d"),
-			  ibfd, oldtag, newtag);
+      _bfd_error_handler (_("error: conflicting CPU architectures %s vs %s in %pB"),
+			  name_table[oldtag], name_table[newtag], ibfd);
       return -1;
     }
 
@@ -14632,7 +14632,8 @@ elf32_arm_merge_eabi_attributes (bfd *ibfd, struct bfd_link_info *info)
 	    arch_attr = tag_cpu_arch_combine (ibfd, out_attr[i].i,
 					      &secondary_compat_out,
 					      in_attr[i].i,
-					      secondary_compat);
+					      secondary_compat,
+					      name_table);
 
 	    /* Return with error if failed to merge.  */
 	    if (arch_attr == -1)
diff --git a/ld/testsuite/ld-arm/attr-merge-9.out b/ld/testsuite/ld-arm/attr-merge-9.out
index 6c3e5f36c17..552a80ab4d1 100644
--- a/ld/testsuite/ld-arm/attr-merge-9.out
+++ b/ld/testsuite/ld-arm/attr-merge-9.out
@@ -1,2 +1,2 @@
-.*: error: .*: conflicting CPU architectures 10/16
+.*: error: conflicting CPU architectures ARM v7 vs ARM v8-M.baseline in .*
 .*: failed to merge target specific data of file tmpdir/attr-merge-9b.o
diff --git a/ld/testsuite/ld-arm/attr-merge-arch-2.d b/ld/testsuite/ld-arm/attr-merge-arch-2.d
index f7de02cf240..cebea49acbe 100644
--- a/ld/testsuite/ld-arm/attr-merge-arch-2.d
+++ b/ld/testsuite/ld-arm/attr-merge-arch-2.d
@@ -2,4 +2,4 @@
 #source: attr-merge-arch-2b.s
 #as:
 #ld: -e main
-#error: conflicting CPU architectures 13/0
+#error: conflicting CPU architectures ARM v7E-M vs Pre v4 in .*
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] arm: Make 'conflicting CPU architectures' error message more user-friendly
  2023-09-01 13:59 [PATCH] arm: Make 'conflicting CPU architectures' error message more user-friendly Christophe Lyon
@ 2023-09-04 12:19 ` Nick Clifton
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2023-09-04 12:19 UTC (permalink / raw)
  To: Christophe Lyon, binutils, richard.earnshaw

Hi Christophe,

> 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  <christophe.lyon@linaro.org>
> 
> 	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.
>

Approved - please apply.

Cheers
   Nick



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-09-04 12:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-01 13:59 [PATCH] arm: Make 'conflicting CPU architectures' error message more user-friendly Christophe Lyon
2023-09-04 12:19 ` Nick Clifton

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).