From 4b05e0a74b3fb21b56e821423b8a334e4be9cfe7 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Wed, 9 Mar 2016 15:43:13 +0000 Subject: [PATCH] Fix v850 bfd arch info printable names Currently, it's not possible to manually set some of the v850 archs in gdb: (gdb) set architecture v850 v850 (using old gcc ABI) v850-rh850 v850e v850e (using old gcc ABI) v850e1 [...] (gdb) set architecture v850 (using old gcc ABI) Ambiguous item "v850 (using old gcc ABI)". The problem is that "set architecture" is a GDB "enum command", and GDB only considers an enum value to be the string up until the first space. So writing "v850 (using old gcc ABI)" is the same as writing "v850", and then that's not an unambiguous arch printable name prefix. v850 is actually the only arch that has spaces in its printable name. One can conveniently see that with e.g.: (gdb) set max-completions unlimited (gdb) complete set architecture ... Rather than hack GDB into accepting this somehow, make v850 arch printable names more like the printable names of the other archs, and put the abi variant in the "machine" part, after a ':'. We now get: (gdb) set architecture v850 v850:old-gcc-abi v850:rh850 v850e v850e1 v850e1:old-gcc-abi v850e2 v850e2:old-gcc-abi [...] And now "set architecture v850:old-gcc-abi" works as expected. I ran the binutils/gas/ld testsuites, and found no regressions. I don't have a cross compiler handy, but I ran the gdb tests anyway, which covers at least some snoke testing. I think that the OUTPUT_ARCH in ld/scripttempl/v850.sc may have got broken with the previous 2012 change, since I hacked v850_rh850.sc to output "v850" and ld failed to grok it. I think it only works if the old GCC ABI is the configured v850 default ABI. That's now fixed by changing to use explicit v850:old-gcc-abi. Also, this actually "fixes" an existing GDB test, which isn't likewise expecting spaces in arch names, when GDB is configured for --target=v850: (gdb) FAIL: gdb.xml/tdesc-arch.exp: read valid architectures bfd/ChangeLog: 2016-03-09 Pedro Alves * cpu-v850.c (N): Append ":old-gcc-abi" instead of " (using old gcc ABI)" to printable name. * cpu-v850_rh850.c (bfd_v850_rh850_arch): Use "v850:rh850" instead of "v850-rh850" as printable name. ld/ChangeLog: 2016-03-09 Pedro Alves * scripttempl/v850.sc: Use "v850:old-gcc-abi" as OUTPUT_ARCH. * scripttempl/v850_rh850.sc: Use "v850:rh850" as OUTPUT_ARCH. --- bfd/ChangeLog | 7 +++++++ bfd/cpu-v850.c | 2 +- bfd/cpu-v850_rh850.c | 2 +- ld/ChangeLog | 5 +++++ ld/scripttempl/v850.sc | 2 +- ld/scripttempl/v850_rh850.sc | 2 +- 6 files changed, 16 insertions(+), 4 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index d0dfd9bf44..b2075e4b30 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +2016-03-09 Pedro Alves + + * cpu-v850.c (N): Append ":old-gcc-abi" instead of " (using old + gcc ABI)" to printable name. + * cpu-v850_rh850.c (bfd_v850_rh850_arch): Use "v850:rh850" instead + of "v850-rh850" as printable name. + 2016-03-09 Leon Winter PR ld/19623 diff --git a/bfd/cpu-v850.c b/bfd/cpu-v850.c index 472c578156..d82d4c02eb 100644 --- a/bfd/cpu-v850.c +++ b/bfd/cpu-v850.c @@ -24,7 +24,7 @@ #include "safe-ctype.h" #define N(number, print, default, next) \ -{ 32, 32, 8, bfd_arch_v850, number, "v850", print " (using old gcc ABI)", 2, default, \ +{ 32, 32, 8, bfd_arch_v850, number, "v850", print ":old-gcc-abi", 2, default, \ bfd_default_compatible, bfd_default_scan, bfd_arch_default_fill, next } #define NEXT NULL diff --git a/bfd/cpu-v850_rh850.c b/bfd/cpu-v850_rh850.c index 3b588874b5..e86749b4a6 100644 --- a/bfd/cpu-v850_rh850.c +++ b/bfd/cpu-v850_rh850.c @@ -38,4 +38,4 @@ static const bfd_arch_info_type arch_info_struct[] = }; const bfd_arch_info_type bfd_v850_rh850_arch = - R (bfd_mach_v850, "v850-rh850", TRUE, & arch_info_struct[0]); + R (bfd_mach_v850, "v850:rh850", TRUE, & arch_info_struct[0]); diff --git a/ld/ChangeLog b/ld/ChangeLog index 8776e4c881..f29a3ab2eb 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +2016-03-09 Pedro Alves + + * scripttempl/v850.sc: Use "v850:old-gcc-abi" as OUTPUT_ARCH. + * scripttempl/v850_rh850.sc: Use "v850:rh850" as OUTPUT_ARCH. + 2016-03-08 H.J. Lu PR ld/19789 diff --git a/ld/scripttempl/v850.sc b/ld/scripttempl/v850.sc index e338bf1bd1..cf7cd20aad 100644 --- a/ld/scripttempl/v850.sc +++ b/ld/scripttempl/v850.sc @@ -13,7 +13,7 @@ cat << EOF OUTPUT_FORMAT("elf32-v850", "elf32-v850", "elf32-v850") -OUTPUT_ARCH(v850) +OUTPUT_ARCH(v850:old-gcc-abi) ${RELOCATING+ENTRY(_start)} SEARCH_DIR(.); EXTERN(__ctbp __ep __gp); diff --git a/ld/scripttempl/v850_rh850.sc b/ld/scripttempl/v850_rh850.sc index 06e52438e3..a44b9b5f5b 100644 --- a/ld/scripttempl/v850_rh850.sc +++ b/ld/scripttempl/v850_rh850.sc @@ -13,7 +13,7 @@ cat << EOF OUTPUT_FORMAT("elf32-v850-rh850", "elf32-v850-rh850", "elf32-v850-rh850") -OUTPUT_ARCH(v850-rh850) +OUTPUT_ARCH(v850:rh850) ${RELOCATING+ENTRY(_start)} SEARCH_DIR(.); EXTERN(__ctbp __ep __gp);