bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/28336] New: bfd printable arch names not unique


From: vries at gcc dot gnu.org
Subject: [Bug binutils/28336] New: bfd printable arch names not unique
Date: Mon, 13 Sep 2021 14:37:37 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=28336

            Bug ID: 28336
           Summary: bfd printable arch names not unique
           Product: binutils
           Version: 2.38 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

I wrote some code to add a gdb selftest for each architecture, and ran into an
assert complaining about duplicate testname "print_one_insn::ft32".

I realized that this is due to repeating &bfd_ft32_arch[0] at
arch_info_struct[0]:
...
  static const bfd_arch_info_type arch_info_struct[] =
  {
    N (bfd_mach_ft32, "ft32", false, &arch_info_struct[1]),
    N (bfd_mach_ft32b, "ft32b", false, NULL)
  };

  const bfd_arch_info_type bfd_ft32_arch =
    N (bfd_mach_ft32, "ft32", true, arch_info_struct);
...

I'm not sure what the proper usage here is, but this fixed the assert for me:
...
diff --git a/bfd/cpu-ft32.c b/bfd/cpu-ft32.c
index f7112685e0f..d40ef081be9 100644
--- a/bfd/cpu-ft32.c
+++ b/bfd/cpu-ft32.c
@@ -43,7 +43,6 @@

 static const bfd_arch_info_type arch_info_struct[] =
 {
-  N (bfd_mach_ft32, "ft32", false, &arch_info_struct[1]),
   N (bfd_mach_ft32b, "ft32b", false, NULL)
 };

...

Likewise for rx:
...
diff --git a/bfd/cpu-rx.c b/bfd/cpu-rx.c
index 601523691bf..cccadba4970 100644
--- a/bfd/cpu-rx.c
+++ b/bfd/cpu-rx.c
@@ -29,8 +29,7 @@

 static const bfd_arch_info_type arch_info_struct[3] =
 {
-  N (bfd_mach_rx,    "rx",    3, false, arch_info_struct + 1),
-  N (bfd_mach_rx_v2, "rx:v2", 3, false, arch_info_struct + 2),
+  N (bfd_mach_rx_v2, "rx:v2", 3, false, arch_info_struct + 1),
   N (bfd_mach_rx_v3, "rx:v3", 3, false, NULL)
 };

...

Furthermore, I found that the bfd_mach_n1 had a name that didn't match:
...
diff --git a/bfd/cpu-nds32.c b/bfd/cpu-nds32.c
index 3473a569085..e3e9feca10b 100644
--- a/bfd/cpu-nds32.c
+++ b/bfd/cpu-nds32.c
@@ -42,4 +42,4 @@ static const bfd_arch_info_type arch_info_struct[] =
 };

 const bfd_arch_info_type bfd_nds32_arch =
-  N (bfd_mach_n1, "n1h", true, NEXT);
+  N (bfd_mach_n1, "n1", true, NEXT);
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]