Fix xcompile for ARMv7 and our cross toolchain

The naming of architectures is highly inconsistent between
the different components of the toolchain. In binutils, the
file architecture is elf32-littlearch. In GCC it's armv7a-eabi.
This patch adds support for different BFD / GCC names

Change-Id: Ib644f71e8d8b4964adec73eed23921d3838e8aa7
Signed-off-by: Stefan Reinauer <reinauer@google.com>
Reviewed-on: http://review.coreboot.org/1969
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Tested-by: build bot (Jenkins)
Reviewed-by: David Hendricks <dhendrix@chromium.org>
This commit is contained in:
Stefan Reinauer 2012-12-05 17:12:10 -08:00 committed by Ronald G. Minnich
parent 6edb729cee
commit e42133f33e
1 changed files with 12 additions and 7 deletions

View File

@ -120,7 +120,7 @@ $CFLAGS -ffixed-r8 -msoft-float -marm -mabi=aapcs-linux \
report_arch_toolchain() { report_arch_toolchain() {
cat <<EOF cat <<EOF
# elf${TWIDTH}-${TARCH} toolchain (${GCCPREFIX}gcc) # elf${TWIDTH}-${TBFDARCH} toolchain (${GCCPREFIX}gcc)
CC_${TARCH}:=${GCCPREFIX}gcc ${CFLAGS} CC_${TARCH}:=${GCCPREFIX}gcc ${CFLAGS}
AS_${TARCH}:=${GCCPREFIX}as ${ASFLAGS} AS_${TARCH}:=${GCCPREFIX}as ${ASFLAGS}
LD_${TARCH}:=${GCCPREFIX}ld ${LDFLAGS} LD_${TARCH}:=${GCCPREFIX}ld ${LDFLAGS}
@ -140,15 +140,17 @@ touch "$TMPFILE"
trap clean_up EXIT trap clean_up EXIT
# Architecture definition # Architecture definition
SUPPORTED_ARCHITECTURE="x86 arm" SUPPORTED_ARCHITECTURE="x86 armv7"
# ARM Architecture # ARM Architecture
TARCH_arm="littlearm" TARCH_armv7="armv7a"
TCLIST_arm="littlearm" TBFDARCH_armv7="littlearm"
TWIDTH_arm="32" TCLIST_armv7="armv7a"
TWIDTH_armv7="32"
# X86 Architecture # X86 Architecture
TARCH_x86="i386" TARCH_x86="i386"
TBFDARCH_x86="i386"
TCLIST_x86="i386 x86_64" TCLIST_x86="i386 x86_64"
TWIDTH_x86="32" TWIDTH_x86="32"
XGCCPATH=${1:-"`pwd`/util/crossgcc/xgcc/bin/"} XGCCPATH=${1:-"`pwd`/util/crossgcc/xgcc/bin/"}
@ -157,6 +159,7 @@ XGCCPATH=${1:-"`pwd`/util/crossgcc/xgcc/bin/"}
for architecture in $SUPPORTED_ARCHITECTURE; do for architecture in $SUPPORTED_ARCHITECTURE; do
GCCPREFIX="invalid" GCCPREFIX="invalid"
TARCH="$(eval echo \$TARCH_$architecture)" TARCH="$(eval echo \$TARCH_$architecture)"
TBFDARCH="$(eval echo \$TBFDARCH_$architecture)"
TCLIST="$(eval echo \$TCLIST_$architecture)" TCLIST="$(eval echo \$TCLIST_$architecture)"
TWIDTH="$(eval echo \$TWIDTH_$architecture)" TWIDTH="$(eval echo \$TWIDTH_$architecture)"
[ -z "$TARCH" -o -z "$TCLIST" -o -z "$TWIDTH" ] && [ -z "$TARCH" -o -z "$TCLIST" -o -z "$TWIDTH" ] &&
@ -171,14 +174,16 @@ for architecture in $SUPPORTED_ARCHITECTURE; do
for toolchain in $TCLIST; do for toolchain in $TCLIST; do
search="$search $XGCCPATH$toolchain-elf-" search="$search $XGCCPATH$toolchain-elf-"
search="$search $toolchain-elf-" search="$search $toolchain-elf-"
search="$search $XGCCPATH$toolchain-eabi-"
search="$search $toolchain-eabi-"
done done
echo "# $architecture TARCH_SEARCH=$search" echo "# $architecture TARCH_SEARCH=$search"
# Search toolchain by checking assembler capability. # Search toolchain by checking assembler capability.
for gccprefixes in $search ""; do for gccprefixes in $search ""; do
program_exists "${gccprefixes}as" || continue program_exists "${gccprefixes}as" || continue
testas "$gccprefixes" "$TWIDTH" "$TARCH" "" && break testas "$gccprefixes" "$TWIDTH" "$TBFDARCH" "" && break
testas "$gccprefixes" "$TWIDTH" "$TARCH" "TRUE" && break testas "$gccprefixes" "$TWIDTH" "$TBFDARCH" "TRUE" && break
done done
if [ "$GCCPREFIX" = "invalid" ]; then if [ "$GCCPREFIX" = "invalid" ]; then