This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH 04/15] MIPS/GAS/test: Correct handling of arch overrides
On Mon, 4 Oct 2010, Richard Sandiford wrote:
> > gas/testsuite/
> > * gas/mips/mips.exp (run_dump_test_arch): Get the name of the
> > architecture to check against for an architecture-specific test
> > from the properties instead of the name passed.
>
> OK, although I'm uneasy about the way you're relying on an undocumented
> implementation detail (the ordering of the properties).
This is documented with mips_arch_create:
# The new entry's property list is initialized to contain ARCH, any
# properties specified by PROPS, and the properties associated with
# the entry specified by EXTENDS. (The new architecture is considered
# to extend the capabilities provided by that architecture.)
although I can see in the mathematical sense it does not make it explicit
the list is ordered in the sequence quoted. That's how I found it anyway,
when determining if any new code has to be added to get at the "canonical"
ARCH.
> Please add a comment like:
>
> The first element is always the "canonical" target name for ARCH
>
> after:
>
> # mips_arch_properties ARCH (optional:) INCLUDE_GPRSIZE
> #
> # This function returns the property list associated with ARCH in the
> # architecture data array. If INCLUDE_GPRSIZE is non-zero, an additional
> # "gpr32" or "gpr64" property will be returned as part of the list based
> # on the architecture's GPR size.
It doesn't hurt to make it more explicit though, so here is what I have
in the end applied. Thanks.
Maciej
Index: binutils-2.20.51/gas/testsuite/gas/mips/mips.exp
===================================================================
--- binutils-2.20.51.orig/gas/testsuite/gas/mips/mips.exp
+++ binutils-2.20.51/gas/testsuite/gas/mips/mips.exp
@@ -194,9 +194,12 @@ proc mips_arch_displayname {arch} {
# mips_arch_properties ARCH (optional:) INCLUDE_GPRSIZE
#
# This function returns the property list associated with ARCH in the
-# architecture data array. If INCLUDE_GPRSIZE is non-zero, an additional
-# "gpr32" or "gpr64" property will be returned as part of the list based
-# on the architecture's GPR size.
+# architecture data array, including the "canonical" target name as the
+# first element.
+#
+# If INCLUDE_GPRSIZE is non-zero, an additional "gpr32" or "gpr64"
+# property will be returned as part of the list based on the
+# architecture's GPR size.
proc mips_arch_properties {arch {include_gprsize 1}} {
array set archdata [mips_arch_data $arch]
set props $archdata(props)
@@ -286,7 +289,8 @@ proc mips_arch_list_matching {args} {
proc run_dump_test_arch { name arch } {
global subdir srcdir
- set archname "${arch}@${name}"
+ set proparch [lindex [mips_arch_properties $arch 0] 0]
+ set archname "${proparch}@${name}"
if { [file exists "$srcdir/$subdir/${archname}.d"] } {
set name $archname
}