[LinuxBIOS] r434 - in LinuxBIOSv3: . util/xcompile

svn at openbios.org svn at openbios.org
Thu Jul 5 19:27:24 CEST 2007


Author: mjones
Date: 2007-07-05 19:27:23 +0200 (Thu, 05 Jul 2007)
New Revision: 434

Modified:
   LinuxBIOSv3/Makefile
   LinuxBIOSv3/util/xcompile/xcompile
Log:
Add testcc() function to xcompile to check for various compiler flags and set them in the CFLAGS variable if they are located.
Added check for -fno-stack-protector flag.

Signed-off-by: Jordan Crouse <jordan.crouse at amd.com>
Acked-by: Uwe Hermann <uwe at hermann-uwe.de>
Acked-by: Marc Jones <marc.jones at amd.com>



Modified: LinuxBIOSv3/Makefile
===================================================================
--- LinuxBIOSv3/Makefile	2007-07-05 16:58:10 UTC (rev 433)
+++ LinuxBIOSv3/Makefile	2007-07-05 17:27:23 UTC (rev 434)
@@ -96,6 +96,7 @@
 AS := $(AS_$(ARCH))
 LD := $(LD_$(ARCH))
 OBJCOPY := $(OBJCOPY_$(ARCH))
+CFLAGS += $(CFLAGS_$(ARCH))
 
 CPPFLAGS := $(LINUXBIOSINCLUDE)
 CFLAGS += $(LINUXBIOSINCLUDE)

Modified: LinuxBIOSv3/util/xcompile/xcompile
===================================================================
--- LinuxBIOSv3/util/xcompile/xcompile	2007-07-05 16:58:10 UTC (rev 433)
+++ LinuxBIOSv3/util/xcompile/xcompile	2007-07-05 17:27:23 UTC (rev 434)
@@ -25,6 +25,15 @@
 			-e s/s390x/s390/ -e s/parisc64/parisc/ \
 			-e s/ppc.*/powerpc/ -e s/mips.*/mips/`
 
+testcc()
+{
+	TMP=".$$$$.tmp"
+	$1 $2 -S -xc /dev/null -o $TMP > /dev/null 2>&1
+	ret=$?
+	rm -rf $TMP
+	return $ret 
+}
+
 searchgnu()
 {
 	# $1 short name
@@ -45,18 +54,23 @@
 case  "$ARCH" in
 "x86_64")
 	echo "CC_x86 := gcc -m32"
+	CC="gcc -m32"
+
 	searchgnu as >/dev/null && echo "AS_x86 := $(searchgnu as) --32"
 	searchgnu ld >/dev/null && echo "LD_x86 := $(searchgnu ld) -b elf32-i386 -melf_i386"
 	searchgnu objcopy >/dev/null && echo "OBJCOPY_x86 := $(searchgnu objcopy)"
 	;;
 "x86")
 	echo "CC_x86 := gcc"
+	CC="gcc"
+
 	searchgnu as >/dev/null && echo "AS_x86 := $(searchgnu as)"
 	searchgnu ld >/dev/null && echo "LD_x86 := $(searchgnu ld)"
 	searchgnu objcopy >/dev/null && echo "OBJCOPY_x86 := $(searchgnu objcopy)"
 	;;
 *)
 	# FIXME: This should be detected.
+	CC="i386-linux-gcc"
 	echo "CC_x86 := i386-linux-gcc"
 	echo "AS_x86 := i386-linux-as"
 	echo "LD_x86 := i386-linux-ld"
@@ -64,6 +78,13 @@
 	;;
 esac
 
+# This is where we test for various flags and other things
+
+CFLAGS=""
+testcc "$CC" "-fno-stack-protector" && CFLAGS="$CFLAGS-fno-stack-protector " 
+
+echo "CFLAGS_x86 := $CFLAGS"
+
 # TODO: The same as above for PowerPC, and other architectures
 #       as soon as they are supported by LinuxBIOSv3.
 





More information about the coreboot mailing list