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<TAB>
 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<TAB>
 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  <palves@redhat.com>

	* 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  <palves@redhat.com>

	* scripttempl/v850.sc: Use "v850:old-gcc-abi" as OUTPUT_ARCH.
	* scripttempl/v850_rh850.sc: Use "v850:rh850" as OUTPUT_ARCH.
This commit is contained in:
Pedro Alves 2016-03-09 15:43:13 +00:00
parent 26c62da040
commit 4b05e0a74b
6 changed files with 16 additions and 4 deletions

View file

@ -1,3 +1,10 @@
2016-03-09 Pedro Alves <palves@redhat.com>
* 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 <winter-gcc@bfw-online.de> 2016-03-09 Leon Winter <winter-gcc@bfw-online.de>
PR ld/19623 PR ld/19623

View file

@ -24,7 +24,7 @@
#include "safe-ctype.h" #include "safe-ctype.h"
#define N(number, print, default, next) \ #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 } bfd_default_compatible, bfd_default_scan, bfd_arch_default_fill, next }
#define NEXT NULL #define NEXT NULL

View file

@ -38,4 +38,4 @@ static const bfd_arch_info_type arch_info_struct[] =
}; };
const bfd_arch_info_type bfd_v850_rh850_arch = 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]);

View file

@ -1,3 +1,8 @@
2016-03-09 Pedro Alves <palves@redhat.com>
* 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 <hongjiu.lu@intel.com> 2016-03-08 H.J. Lu <hongjiu.lu@intel.com>
PR ld/19789 PR ld/19789

View file

@ -13,7 +13,7 @@ cat << EOF
OUTPUT_FORMAT("elf32-v850", "elf32-v850", OUTPUT_FORMAT("elf32-v850", "elf32-v850",
"elf32-v850") "elf32-v850")
OUTPUT_ARCH(v850) OUTPUT_ARCH(v850:old-gcc-abi)
${RELOCATING+ENTRY(_start)} ${RELOCATING+ENTRY(_start)}
SEARCH_DIR(.); SEARCH_DIR(.);
EXTERN(__ctbp __ep __gp); EXTERN(__ctbp __ep __gp);

View file

@ -13,7 +13,7 @@ cat << EOF
OUTPUT_FORMAT("elf32-v850-rh850", "elf32-v850-rh850", OUTPUT_FORMAT("elf32-v850-rh850", "elf32-v850-rh850",
"elf32-v850-rh850") "elf32-v850-rh850")
OUTPUT_ARCH(v850-rh850) OUTPUT_ARCH(v850:rh850)
${RELOCATING+ENTRY(_start)} ${RELOCATING+ENTRY(_start)}
SEARCH_DIR(.); SEARCH_DIR(.);
EXTERN(__ctbp __ep __gp); EXTERN(__ctbp __ep __gp);