aboutsummaryrefslogtreecommitdiff
path: root/bfd/cpu-arc.c
diff options
context:
space:
mode:
authorClaudiu Zissulescu <claziss@gmail.com>2023-09-25 17:03:06 +0300
committerClaudiu Zissulescu <claziss@gmail.com>2023-09-25 17:03:06 +0300
commitd9d85c086f5ceed7662572ff101bf6e1b74544a5 (patch)
tree4211a91da1d9cfa8d53618916290fae346056493 /bfd/cpu-arc.c
parent7f2b40892ac65feddf8d532548f0fff0af01a3e9 (diff)
downloadgdb-d9d85c086f5ceed7662572ff101bf6e1b74544a5.zip
gdb-d9d85c086f5ceed7662572ff101bf6e1b74544a5.tar.gz
gdb-d9d85c086f5ceed7662572ff101bf6e1b74544a5.tar.bz2
Revert "arc: Add new ARCv3 ISA to BFD."
This reverts commit 06e8d9861d16c5b7e6920ad0e89889ccf45c575a.
Diffstat (limited to 'bfd/cpu-arc.c')
-rw-r--r--bfd/cpu-arc.c79
1 files changed, 40 insertions, 39 deletions
diff --git a/bfd/cpu-arc.c b/bfd/cpu-arc.c
index a5e0f80..390a69d 100644
--- a/bfd/cpu-arc.c
+++ b/bfd/cpu-arc.c
@@ -26,53 +26,51 @@
static const bfd_arch_info_type *
arc_compatible (const bfd_arch_info_type *a, const bfd_arch_info_type *b);
-#define ARC(BITS_WORD, BITS_ADDR, MACH, PRINT_NAME, DEFAULT_P, NEXT) \
-{ \
- BITS_WORD, /* 32 bits in a word. */ \
- BITS_ADDR, /* 32 bits in an address. */ \
- 8, /* 8 bits in a byte. */ \
- bfd_arch_arc, \
- MACH, \
- "arc", \
- PRINT_NAME, \
- 4, /* section alignment power. */ \
- DEFAULT_P, \
- arc_compatible, \
- bfd_default_scan, \
- bfd_arch_default_fill, \
- NEXT, \
- 0 /* Maximum offset of a reloc from the start of an insn. */ \
-}
+#define ARC(mach, print_name, default_p, next) \
+ { \
+ 32, /* Bits in a word. */ \
+ 32, /* Bits in an address. */ \
+ 8, /* Bits in a byte. */ \
+ bfd_arch_arc, \
+ mach, \
+ "arc", \
+ print_name, \
+ 4, /* Section alignment power. */ \
+ default_p, \
+ arc_compatible, \
+ bfd_default_scan, \
+ bfd_arch_default_fill, \
+ next, \
+ 0 /* Maximum offset of a reloc from the start of an insn. */ \
+ }
static const bfd_arch_info_type arch_info_struct[] =
{
- ARC (32, 32, bfd_mach_arc_arc600, "A6" , false, &arch_info_struct[1]),
- ARC (32, 32, bfd_mach_arc_arc601, "ARC601", false, &arch_info_struct[2]),
- ARC (32, 32, bfd_mach_arc_arc700, "ARC700", false, &arch_info_struct[3]),
- ARC (32, 32, bfd_mach_arc_arc700, "A7", false, &arch_info_struct[4]),
- ARC (32, 32, bfd_mach_arc_arcv2, "ARCv2", false, &arch_info_struct[5]),
- ARC (32, 32, bfd_mach_arc_arcv2, "EM", false, &arch_info_struct[6]),
- ARC (32, 32, bfd_mach_arc_arcv2, "HS", false, NULL),
+ ARC (bfd_mach_arc_arc600, "A6" , false, &arch_info_struct[1]),
+ ARC (bfd_mach_arc_arc601, "ARC601", false, &arch_info_struct[2]),
+ ARC (bfd_mach_arc_arc700, "ARC700", false, &arch_info_struct[3]),
+ ARC (bfd_mach_arc_arc700, "A7", false, &arch_info_struct[4]),
+ ARC (bfd_mach_arc_arcv2, "ARCv2", false, &arch_info_struct[5]),
+ ARC (bfd_mach_arc_arcv2, "EM", false, &arch_info_struct[6]),
+ ARC (bfd_mach_arc_arcv2, "HS", false, NULL),
};
const bfd_arch_info_type bfd_arc_arch =
- ARC (32, 32, bfd_mach_arc_arc600, "ARC600", true, &arch_info_struct[0]);
-
-/* ARC-specific "compatible" function. The general rule is that if A
- and B are compatible, then this function should return architecture
- that is more "feature-rich", that is, can run both A and B. ARCv2,
- EM and HS all has same mach number, so bfd_default_compatible
- assumes they are the same, and returns an A. That causes issues
- with GDB, because GDB assumes that if machines are compatible, then
- "compatible ()" always returns same machine regardless of argument
- order. As a result GDB gets confused because, for example,
- compatible (ARCv2, EM) returns ARCv2, but compatible (EM, ARCv2)
- returns EM, hence GDB is not sure if they are compatible and prints
- a warning. */
+ ARC (bfd_mach_arc_arc600, "ARC600", true, &arch_info_struct[0]);
+
+/* ARC-specific "compatible" function. The general rule is that if A and B are
+ compatible, then this function should return architecture that is more
+ "feature-rich", that is, can run both A and B. ARCv2, EM and HS all has
+ same mach number, so bfd_default_compatible assumes they are the same, and
+ returns an A. That causes issues with GDB, because GDB assumes that if
+ machines are compatible, then "compatible ()" always returns same machine
+ regardless of argument order. As a result GDB gets confused because, for
+ example, compatible (ARCv2, EM) returns ARCv2, but compatible (EM, ARCv2)
+ returns EM, hence GDB is not sure if they are compatible and prints a
+ warning. */
static const bfd_arch_info_type *
-arc_compatible (const bfd_arch_info_type *a ATTRIBUTE_UNUSED,
- const bfd_arch_info_type *b ATTRIBUTE_UNUSED)
+arc_compatible (const bfd_arch_info_type *a, const bfd_arch_info_type *b)
{
const bfd_arch_info_type * const em = &arch_info_struct[5];
const bfd_arch_info_type * const hs = &arch_info_struct[6];
@@ -86,6 +84,9 @@ arc_compatible (const bfd_arch_info_type *a ATTRIBUTE_UNUSED,
if (a->arch != b->arch)
return NULL;
+ if (a->bits_per_word != b->bits_per_word)
+ return NULL;
+
/* ARCv2|EM and EM. */
if ((a->mach == bfd_mach_arc_arcv2 && b == em)
|| (b->mach == bfd_mach_arc_arcv2 && a == em))