Allow for different BFD elf formats per architecture

The upcoming MIPS toolchain inside chroot generates elf images of
elf32-tradlittlemips format, whereas readily available tools outside
of chroot generate images of elf32-littlemips format. Both of these
formats are perfectly fine, but xcompile accepts only one format per
CPU architecture.

This patch allows to specify multiple formats per architecture, any
matching format will suffice.

BUG=chrome-os-partner:31438
TEST=emerged arm, x86 and mips targets inside chroot

Change-Id: I22405e71ac72b985fad51e2f5d7cc014107b8a9e
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/214599
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Vadim Bendebury 2014-08-27 15:30:19 -07:00 committed by chrome-internal-fetch
commit 7f2f1d5164

View file

@ -167,7 +167,7 @@ XGCCPATH=${1:-"`pwd`/util/crossgcc/xgcc/bin/"}
# MIPS Architecture (Little Endian)
TARCH_mipsel="mipsel"
TBFDARCH_mipsel="littlemips"
TBFDARCH_mipsel="tradlittlemips littlemips"
TCLIST_mipsel="mipsel"
TWIDTH_mipsel="32"
@ -175,7 +175,7 @@ TWIDTH_mipsel="32"
for architecture in $SUPPORTED_ARCHITECTURE; do
GCCPREFIX="invalid"
TARCH="$(eval echo \$TARCH_$architecture)"
TBFDARCH="$(eval echo \$TBFDARCH_$architecture)"
TBFDARCHS="$(eval echo \$TBFDARCH_$architecture)"
TCLIST="$(eval echo \$TCLIST_$architecture)"
TWIDTH="$(eval echo \$TWIDTH_$architecture)"
[ -z "$TARCH" -o -z "$TCLIST" -o -z "$TWIDTH" ] &&
@ -196,10 +196,13 @@ for architecture in $SUPPORTED_ARCHITECTURE; do
echo "# $architecture TARCH_SEARCH=$search"
# Search toolchain by checking assembler capability.
for gccprefixes in $search ""; do
program_exists "${gccprefixes}as" || continue
testas "$gccprefixes" "$TWIDTH" "$TBFDARCH" "" && break
testas "$gccprefixes" "$TWIDTH" "$TBFDARCH" "TRUE" && break
for TBFDARCH in $TBFDARCHS; do
for gccprefixes in $search ""; do
program_exists "${gccprefixes}as" || continue
testas "$gccprefixes" "$TWIDTH" "$TBFDARCH" "" && break
testas "$gccprefixes" "$TWIDTH" "$TBFDARCH" "TRUE" && break
done
[ "$GCCPREFIX" = "invalid" ] || break
done
if [ "$GCCPREFIX" = "invalid" ]; then