Skip to content

Commit 311d282

Browse files
committed
contrib: Use config.sub in test_installed
Correctly running GCC testsuites with an installed compiler requires both the canonical and noncanonical versions of the target triplet: the canonical one for where the testsuite matches on target triplets, and the noncanonical one for various "transform" calls used to find binutils programs. Make test_installed use config.sub to determine the canonical target from any value passed with --target= (and thus make logic to locate the toplevel source directory from its own location unconditional, as it's now used to locate config.sub). * test_installed: Use config.sub to determine canonical target.
1 parent 89110c5 commit 311d282

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

contrib/test_installed

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,16 @@ EOF
104104
*) break;;
105105
esac
106106
done
107-
107+
108+
# Determine the source directory to find config.sub, whether or not
109+
# that is also used to locate the testsuite sources.
110+
file=$0
111+
while [ -h $file ]; do
112+
file=`ls -l $file | sed s/'.* -> '//`
113+
done
114+
top_srcdir=`CDPATH=. && cd \`echo "$file" | sed 's,/*[^/]*$,,;s,^$,.,'\`/.. >/dev/null && ${PWDCMD-pwd}`
108115
if test x"${testsuite+set}" != x"set" && test x"${srcdir+set}" != x"set"; then
109-
file=$0
110-
while [ -h $file ]; do
111-
file=`ls -l $file | sed s/'.* -> '//`
112-
done
113-
srcdir=`CDPATH=. && cd \`echo "$file" | sed 's,/*[^/]*$,,;s,^$,.,'\`/.. >/dev/null && ${PWDCMD-pwd}`
116+
srcdir=$top_srcdir
114117
fi
115118

116119
cat >site.exp <<EOF
@@ -130,7 +133,8 @@ set HOSTCFLAGS ""
130133
set HOSTCXXFLAGS ""
131134
EOF
132135
if test x${target} != x; then
133-
echo "set target_triplet $target" >> site.exp
136+
target_canonical=`$top_srcdir/config.sub $target`
137+
echo "set target_triplet $target_canonical" >> site.exp
134138
echo "set target_alias $target" >> site.exp
135139
fi
136140
if test x"$ALT_CC_UNDER_TEST" != x; then

0 commit comments

Comments
 (0)