X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=util%2Fxcompile%2Fxcompile;h=49263941dfa10d9d1ae47d884b661fa960f76ed1;hb=5e4e2290b653b068b1ca55205efd3fbfcc1fda34;hp=5da78743437a1d5fd2262e77ce67935f7897f916;hpb=e82f4754ee905437d434f0d58c03e9ee2929224e;p=coreboot.git diff --git a/util/xcompile/xcompile b/util/xcompile/xcompile index 5da787434..49263941d 100644 --- a/util/xcompile/xcompile +++ b/util/xcompile/xcompile @@ -5,8 +5,8 @@ # Copyright (C) 2007-2010 coresystems GmbH # # This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 as -# published by the Free Software Foundation. +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -21,7 +21,7 @@ testcc() { echo "_start(void) {}" > .$$$$.c - $1 -nostdlib $2 .$$$$.c -o .$$$$.tmp 2>/dev/null >/dev/null + $1 -nostdlib -Werror $2 .$$$$.c -o .$$$$.tmp 2>/dev/null >/dev/null ret=$? rm -f .$$$$.c .$$$$.tmp return $ret @@ -35,19 +35,21 @@ for make in make gmake gnumake; do done GCCPREFIX=invalid -TMP=`mktemp /tmp/temp.XXXX 2>/dev/null || echo /tmp/temp.78gOIUGz` -touch $TMP +XGCCPATH=${1:-"`pwd`/util/crossgcc/xgcc/bin/"} +echo '#XGCCPATH='${XGCCPATH} +TMPFILE=`mktemp /tmp/temp.XXXX 2>/dev/null || echo /tmp/temp.78gOIUGz` +touch $TMPFILE # This should be a loop over all supported architectures TARCH=i386 TWIDTH=32 -for gccprefixes in `pwd`/util/crossgcc/xgcc/bin/${TARCH}-elf- ${TARCH}-elf- ""; do +for gccprefixes in ${XGCCPATH}${TARCH}-elf- ${TARCH}-elf- ""; do if ! which ${gccprefixes}as 2>/dev/null >/dev/null; then continue fi - rm -f ${TMP}.o - if ${gccprefixes}as -o ${TMP}.o ${TMP}; then - TYPE=`${gccprefixes}objdump -p ${TMP}.o` + rm -f ${TMPFILE}.o + if ${gccprefixes}as -o ${TMPFILE}.o ${TMPFILE}; then + TYPE=`${gccprefixes}objdump -p ${TMPFILE}.o` if [ ${TYPE##* } == "elf${TWIDTH}-${TARCH}" ]; then GCCPREFIX=$gccprefixes ASFLAGS= @@ -56,8 +58,8 @@ for gccprefixes in `pwd`/util/crossgcc/xgcc/bin/${TARCH}-elf- ${TARCH}-elf- ""; break fi fi - if ${gccprefixes}as --32 -o ${TMP}.o ${TMP}; then - TYPE=`${gccprefixes}objdump -p ${TMP}.o` + if ${gccprefixes}as --32 -o ${TMPFILE}.o ${TMPFILE}; then + TYPE=`${gccprefixes}objdump -p ${TMPFILE}.o` if [ ${TYPE##* } == "elf${TWIDTH}-${TARCH}" ]; then GCCPREFIX=$gccprefixes ASFLAGS=--32 @@ -67,7 +69,7 @@ for gccprefixes in `pwd`/util/crossgcc/xgcc/bin/${TARCH}-elf- ${TARCH}-elf- ""; fi fi done -rm -f $TMP ${TMP}.o +rm -f $TMPFILE ${TMPFILE}.o if [ "$GCCPREFIX" = "invalid" ]; then echo '$(error no suitable gcc found)' @@ -75,8 +77,13 @@ if [ "$GCCPREFIX" = "invalid" ]; then fi CC="${GCCPREFIX}gcc" +testcc "$CC" "$CFLAGS-Wa,--divide " && CFLAGS="$CFLAGS-Wa,--divide " testcc "$CC" "$CFLAGS-fno-stack-protector " && CFLAGS="$CFLAGS-fno-stack-protector " testcc "$CC" "$CFLAGS-Wl,--build-id=none " && CFLAGS="$CFLAGS-Wl,--build-id=none " +# GCC 4.6 is much more picky about unused variables. Turn off it's warnings for +# now: +testcc "$CC" "$CFLAGS-Wno-unused-but-set-variable " && \ + CFLAGS="$CFLAGS-Wno-unused-but-set-variable " if which gcc 2>/dev/null >/dev/null; then HOSTCC=gcc @@ -84,11 +91,16 @@ else HOSTCC=cc fi +if [ "`${XGCCPATH}/iasl 2>/dev/null | grep -c ACPI`" -gt 0 ]; then + IASL=${XGCCPATH}iasl +else + IASL=iasl +fi + cat << EOF # elf${TWIDTH}-${TARCH} toolchain AS:=${GCCPREFIX}as ${ASFLAGS} CC:=${GCCPREFIX}gcc ${CFLAGS} -CPP:=${GCCPREFIX}cpp AR:=${GCCPREFIX}ar LD:=${GCCPREFIX}ld ${LDFLAGS} STRIP:=${GCCPREFIX}strip @@ -96,6 +108,8 @@ NM:=${GCCPREFIX}nm OBJCOPY:=${GCCPREFIX}objcopy OBJDUMP:=${GCCPREFIX}objdump +IASL:=${IASL} + # native toolchain HOSTCC:=${HOSTCC} EOF