[coreboot] r1146 - in coreboot-v3: . util/xcompile
svn at coreboot.org
svn at coreboot.org
Wed Mar 11 19:13:44 CET 2009
Author: oxygene
Date: 2009-03-11 19:13:43 +0100 (Wed, 11 Mar 2009)
New Revision: 1146
Modified:
coreboot-v3/Kconfig
coreboot-v3/Makefile
coreboot-v3/util/xcompile/xcompile
Log:
Enable the use of scan-build on the coreboot-v3 tree, too
It requires a flag (CONFIG_SCAN_BUILD) to be set, and then
$ scan-build make
Signed-off-by: Patrick Georgi <patrick.georgi at coresystems.de>
Acked-by: Peter Stuge <peter at stuge.se>
Modified: coreboot-v3/Kconfig
===================================================================
--- coreboot-v3/Kconfig 2009-03-11 16:17:37 UTC (rev 1145)
+++ coreboot-v3/Kconfig 2009-03-11 18:13:43 UTC (rev 1146)
@@ -84,6 +84,14 @@
Say No.
If you are a Gentoo user, say NO!
+config SCAN_BUILD
+ bool "Use clang's scan-build utility for static analysis"
+ depends EXPERT && EXPERIMENTAL && !WHOLE_PROGRAM_COMPILE
+ default n
+ help
+ Change the compiler configuration so that a 'scan-build make'
+ has a chance to succeed.
+
endmenu
source mainboard/Kconfig
Modified: coreboot-v3/Makefile
===================================================================
--- coreboot-v3/Makefile 2009-03-11 16:17:37 UTC (rev 1145)
+++ coreboot-v3/Makefile 2009-03-11 18:13:43 UTC (rev 1146)
@@ -36,14 +36,14 @@
# Do not print "Entering directory ...".
MAKEFLAGS += --no-print-directory
-CC := gcc
+CC ?= gcc
CFLAGS := -Os -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-Werror-implicit-function-declaration -Wstrict-aliasing \
-fno-common -ffreestanding -fno-builtin -fomit-frame-pointer \
-mpreferred-stack-boundary=2 -mregparm=3 -pipe
# FIXME: Does stack boundary or regparm break the code on real hardware?
-HOSTCC := gcc
+HOSTCC := $(CC)
HOSTCXX := g++
HOSTCFLAGS := -Wall -Wstrict-prototypes -g -fomit-frame-pointer \
-Wno-unused -Wno-sign-compare
@@ -61,9 +61,6 @@
KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)
export KERNELVERSION
-include $(shell $(src)/util/xcompile/xcompile > $(src)/.xcompile || \
- { echo "complete\\ toolchain" && rm -f $(src)/.xcompile && exit 1; }; echo $(src)/.xcompile)
-
ifeq ($(strip $(have_dotconfig)),)
all:
@@ -73,6 +70,9 @@
include $(src)/.config
+include $(shell scanbuild=$(CONFIG_SCAN_BUILD) $(src)/util/xcompile/xcompile > $(src)/.xcompile || \
+ { echo "complete\\ toolchain" && rm -f $(src)/.xcompile && exit 1; }; echo $(src)/.xcompile)
+
ifneq ($(CONFIG_LOCALVERSION),"")
COREBOOT_EXTRA_VERSION := -$(shell echo $(CONFIG_LOCALVERSION))
endif
Modified: coreboot-v3/util/xcompile/xcompile
===================================================================
--- coreboot-v3/util/xcompile/xcompile 2009-03-11 16:17:37 UTC (rev 1145)
+++ coreboot-v3/util/xcompile/xcompile 2009-03-11 18:13:43 UTC (rev 1146)
@@ -55,8 +55,20 @@
case "$ARCH" in
"x86_64")
- echo "CC_x86 := gcc -m32"
- CC="gcc -m32"
+ if [ "$scanbuild" = "y" ]; then
+ ccwrap=`mktemp`
+ mkdir -p build
+ mv $ccwrap build
+ ccwrap=$PWD/build/`basename $ccwrap`
+ echo '#!/bin/bash' > $ccwrap
+ echo $CC' -m32 "$@"' >> $ccwrap
+ chmod +x $ccwrap
+ echo "CC_x86 := $ccwrap"
+ CC=$ccwrap
+ else
+ echo "CC_x86 := gcc -m32"
+ CC="gcc -m32"
+ fi
searchgnu ar >/dev/null && echo "AR_x86 := $(searchgnu ar)"
searchgnu as >/dev/null && echo "AS_x86 := $(searchgnu as) --32"
@@ -68,8 +80,13 @@
;;
"x86")
if [ "$OS" != "Darwin" ]; then
- echo "CC_x86 := gcc"
- CC="gcc"
+ if [ "$scanbuild" = "y" ]; then
+ echo 'CC_x86 := $(CC)'
+ if [ "$CC" = "" ]; then CC=gcc; fi
+ else
+ echo "CC_x86 := gcc"
+ CC="gcc"
+ fi
searchgnu ar >/dev/null && echo "AR_x86 := $(searchgnu ar)"
searchgnu as >/dev/null && echo "AS_x86 := $(searchgnu as)"
More information about the coreboot
mailing list