Changeset 5113
- Timestamp:
- Feb 10, 2010 9:31:38 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
Makefile (modified) (1 diff)
-
util/xcompile/xcompile (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Makefile
r5110 r5113 222 222 INCLUDES += -include $(obj)/build.h 223 223 224 try-run= $(shell set -e; \ 225 TMP=".$$$$.tmp"; \ 226 if ($(1)) > /dev/null 2>&1; \ 227 then echo "$(2)"; \ 228 else echo "$(3)"; \ 229 fi; rm -rf "$$TMP") 230 231 cc-option= $(call try-run,\ 232 $(CC) $(1) -S -xc /dev/null -o "$$TMP", $(1), $(2)) 233 234 STACKPROTECT += $(call cc-option, -fno-stack-protector,) 235 236 CFLAGS = $(STACKPROTECT) $(INCLUDES) -Os -nostdinc 224 CFLAGS = $(INCLUDES) -Os -nostdinc 237 225 CFLAGS += -nostdlib -Wall -Wundef -Wstrict-prototypes -Wmissing-prototypes 238 226 CFLAGS += -Wwrite-strings -Wredundant-decls -Wno-trigraphs -
trunk/util/xcompile/xcompile
r4952 r5113 1 #!/bin/sh 2 # 3 # This file is part of the coreboot project. 4 # 5 # Copyright (C) 2007-2010 coresystems GmbH 6 # 7 # This program is free software; you can redistribute it and/or modify 8 # it under the terms of the GNU General Public License version 2 as 9 # published by the Free Software Foundation. 10 # 11 # This program is distributed in the hope that it will be useful, 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 # GNU General Public License for more details. 15 # 16 # You should have received a copy of the GNU General Public License 17 # along with this program; if not, write to the Free Software 18 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 # 20 21 testcc() 22 { 23 echo "_start(void) {}" > .$$$$.c 24 $1 -nostdlib $2 .$$$$.c -o .$$$$.tmp 2>/dev/null >/dev/null 25 ret=$? 26 rm -f .$$$$.c .$$$$.tmp 27 return $ret 28 } 1 29 2 30 for make in make gmake gnumake; do … … 9 37 GCCPREFIX=invalid 10 38 TMP=`mktemp /tmp/temp.XXXX 2>/dev/null || echo /tmp/temp.78gOIUGz` 11 echo "mov %eax, %eax" > ${TMP}.s 12 printf "\x7fELF\n" > ${TMP}.compare 13 for gccprefixes in `pwd`/util/crossgcc/xgcc/bin/i386-elf- i386-elf- ""; do 14 if which ${gccprefixes}as 2>/dev/null >/dev/null; then 15 printf "" 16 else 39 touch $TMP 40 41 # This should be a loop over all supported architectures 42 TARCH=i386 43 TWIDTH=32 44 for gccprefixes in `pwd`/util/crossgcc/xgcc/bin/${TARCH}-elf- ${TARCH}-elf- ""; do 45 if ! which ${gccprefixes}as 2>/dev/null >/dev/null; then 17 46 continue 18 47 fi 19 48 rm -f ${TMP}.o 20 if ${gccprefixes}as - -32 -o ${TMP}.o ${TMP}.s; then21 cut -c-4 ${TMP}.o > ${TMP}.test 2>/dev/null22 if cmp ${TMP}.test ${TMP}.compare; then49 if ${gccprefixes}as -o ${TMP}.o ${TMP}; then 50 TYPE=`${gccprefixes}objdump -p ${TMP}.o` 51 if [ ${TYPE##* } == "elf${TWIDTH}-${TARCH}" ]; then 23 52 GCCPREFIX=$gccprefixes 53 ASFLAGS= 54 CFLAGS= 55 LDFLAGS= 56 break 57 fi 58 fi 59 if ${gccprefixes}as --32 -o ${TMP}.o ${TMP}; then 60 TYPE=`${gccprefixes}objdump -p ${TMP}.o` 61 if [ ${TYPE##* } == "elf${TWIDTH}-${TARCH}" ]; then 62 GCCPREFIX=$gccprefixes 63 ASFLAGS=--32 64 CFLAGS="-m32 " 65 LDFLAGS="-b elf32-i386" 24 66 break 25 67 fi 26 68 fi 27 69 done 28 rm -f $TMP ${TMP}. s ${TMP}.o ${TMP}.compare ${TMP}.test70 rm -f $TMP ${TMP}.o 29 71 30 72 if [ "$GCCPREFIX" = "invalid" ]; then … … 33 75 fi 34 76 35 cat << afteroptions 36 AS:=${GCCPREFIX}as --32 37 CC:=${GCCPREFIX}gcc -m32 77 CC="${GCCPREFIX}gcc" 78 testcc "$CC" "$CFLAGS-fno-stack-protector " && CFLAGS="$CFLAGS-fno-stack-protector " 79 testcc "$CC" "$CFLAGS-Wl,--build-id=none " && CFLAGS="$CFLAGS-Wl,--build-id=none " 80 81 if which gcc 2>/dev/null >/dev/null; then 82 HOSTCC=gcc 83 else 84 HOSTCC=cc 85 fi 86 87 cat << EOF 88 # elf${TWIDTH}-${TARCH} toolchain 89 AS:=${GCCPREFIX}as ${ASFLAGS} 90 CC:=${GCCPREFIX}gcc ${CFLAGS} 38 91 CPP:=${GCCPREFIX}cpp 39 92 AR:=${GCCPREFIX}ar 40 LD:=${GCCPREFIX}ld -b elf32-i38693 LD:=${GCCPREFIX}ld ${LDFLAGS} 41 94 STRIP:=${GCCPREFIX}strip 42 95 NM:=${GCCPREFIX}nm 43 96 OBJCOPY:=${GCCPREFIX}objcopy 44 97 OBJDUMP:=${GCCPREFIX}objdump 45 HOSTCC:=gcc 46 afteroptions 98 99 # native toolchain 100 HOSTCC:=${HOSTCC} 101 EOF 102
Note: See TracChangeset
for help on using the changeset viewer.
