Patchwork coreboot and LLVM

login
register
about
Submitter Patrick Georgi
Date 2010-03-15 09:41:39
Message ID <4B9E00D3.6000407@georgi-clan.de>
Download mbox | patch
Permalink /patch/1054/
State Accepted
Headers show

Comments

Patrick Georgi - 2010-03-15 09:41:39
Am 15.03.2010 01:11, schrieb Stefan Reinauer:
> See patch... This patch allows me to compile coreboot with LLVM/clang.
> 
> To actually use LLVM/clang, I just hard coded it in xcompile for now:
This makes it configurable. Please test.

Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de>

Patch

Index: src/Kconfig
===================================================================
--- src/Kconfig	(revision 5210)
+++ src/Kconfig	(working copy)
@@ -46,15 +46,28 @@ 
 	  Select the prefix to all files put into the image. It's "fallback"
 	  by default, "normal" is a common alternative.
 
+choice
+	prompt "Compiler"
+	default COMPILER_GCC
+	help
+	  This option allows you to select the compiler used for building
+	  coreboot.
+
+config COMPILER_GCC
+	bool "GCC"
+config COMPILER_LLVM_CLANG
+	bool "clang"
+endchoice
+
 config SCANBUILD_ENABLE
-	bool "build with scan-build for static analysis"
+	bool "Build with scan-build for static analysis"
 	default n
 	help
 	  Changes the build process to scan-build is used.
 	  Requires scan-build in path.
 
 config SCANBUILD_REPORT_LOCATION
-	string "directory to put scan-build report in"
+	string "Directory to put scan-build report in"
 	default ""
 	depends on SCANBUILD_ENABLE
 	help
Index: Makefile
===================================================================
--- Makefile	(revision 5210)
+++ Makefile	(working copy)
@@ -22,8 +22,10 @@ 
 ifeq ($(INNER_SCANBUILD),y)
 CC_real:=$(CC)
 endif
+
 $(if $(wildcard .xcompile),,$(eval $(shell bash util/xcompile/xcompile > .xcompile)))
 include .xcompile
+
 ifeq ($(INNER_SCANBUILD),y)
 CC:=$(CC_real)
 HOSTCC:=$(CC_real) --hostcc
@@ -78,6 +80,12 @@ 
 
 include $(top)/.config
 
+ifneq ($(INNER_SCANBUILD),y)
+ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y)
+CC:=clang -m32
+endif
+endif
+
 ARCHDIR-$(CONFIG_ARCH_X86)    := i386
 ARCHDIR-$(CONFIG_ARCH_POWERPC) := ppc