Edward O'Callaghan (eocallaghan@alterapraxis.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5823
-gerrit
commit 900118127bc669ca349747446f35f87b9a13a30b Author: Edward O'Callaghan eocallaghan@alterapraxis.com Date: Fri May 23 10:57:52 2014 +1000
build: Use clang driver to invocate linker and link compiler-rt
NOTFORMERGE: This does not _yet_ work with the current clang driver, pending upstream fixes. ***
Let the Clang driver frontend invocate the correct target linker and runtime symbols from compiler-rt.
*** Requires at least clang 3.5.0 r211866.
Change-Id: I8b5a824eab98568a77df82596c175a8f0129c5e7 Signed-off-by: Edward O'Callaghan eocallaghan@alterapraxis.com --- Makefile | 2 +- src/arch/x86/Makefile.inc | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile index 195bfe6..f9cacfc 100644 --- a/Makefile +++ b/Makefile @@ -109,7 +109,7 @@ include $(HAVE_DOTCONFIG)
ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y) # FIXME: armv7/aarch64 won't build right now -CFLAGS_x86_32 = -no-integrated-as -Qunused-arguments -target i386-elf -m32 +CFLAGS_x86_32 = -no-integrated-as -Qunused-arguments -target i386-elf -m32 -rtlib=compiler-rt CC_x86_32:=clang
ifneq ($(CONFIG_MMX),y) diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc index 125e9de..e92340e 100644 --- a/src/arch/x86/Makefile.inc +++ b/src/arch/x86/Makefile.inc @@ -209,7 +209,7 @@ romstage-libs ?= $(objcbfs)/romstage_null.debug: $$(romstage-objs) $(objgenerated)/romstage_null.ld $$(romstage-libs) @printf " LINK $(subst $(obj)/,,$(@))\n" ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y) - $(LD_romstage) -nostdlib -nostartfiles -static -o $@ -L$(obj) --start-group $(romstage-objs) $(romstage-libs) $(LIBGCC_FILE_NAME_romstage) --end-group -T $(objgenerated)/romstage_null.ld + $(CC_romstage) $(CFLAGS_romstage) -Wl,-nostdlib -Wl,-nostartfiles -static -o $@ -L$(obj) -Wl,--start-group $(romstage-objs) $(romstage-libs) -Wl,--end-group -Wl,-T $(objgenerated)/romstage_null.ld else $(CC_romstage) $(CFLAGS_romstage) -nostdlib -nostartfiles -static -o $@ -L$(obj) -T $(objgenerated)/romstage_null.ld -Wl,--wrap,__divdi3 -Wl,--wrap,__udivdi3 -Wl,--wrap,__moddi3 -Wl,--wrap,__umoddi3 -Wl,--start-group $(romstage-objs) $(romstage-libs) $(LIBGCC_FILE_NAME_romstage) -Wl,--end-group endif @@ -221,7 +221,7 @@ endif $(objcbfs)/romstage_xip.debug: $$(romstage-objs) $(objgenerated)/romstage_xip.ld $$(romstage-libs) @printf " LINK $(subst $(obj)/,,$(@))\n" ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y) - $(LD_romstage) -nostdlib -nostartfiles -static -o $@ -L$(obj) --start-group $(romstage-objs) $(romstage-libs) $(LIBGCC_FILE_NAME_romstage) --end-group -T $(objgenerated)/romstage_xip.ld + $(CC_romstage) $(CFLAGS_romstage) -Wl,-nostdlib -Wl,-nostartfiles -static -o $@ -L$(obj) -Wl,--start-group $(romstage-objs) $(romstage-libs) -Wl,--end-group -Wl,-T $(objgenerated)/romstage_xip.ld else $(CC_romstage) $(CFLAGS_romstage) -nostdlib -nostartfiles -static -o $@ -L$(obj) -T $(objgenerated)/romstage_xip.ld -Wl,--wrap,__divdi3 -Wl,--wrap,__udivdi3 -Wl,--wrap,__moddi3 -Wl,--wrap,__umoddi3 -Wl,--start-group $(romstage-objs) $(romstage-libs) $(LIBGCC_FILE_NAME_romstage) -Wl,--end-group endif @@ -332,7 +332,7 @@ endif $(objgenerated)/ramstage.o: $$(ramstage-objs) $(LIBGCC_FILE_NAME_ramstage) $$(ramstage-libs) @printf " CC $(subst $(obj)/,,$(@))\n" ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y) - $(LD_ramstage) -m elf_i386 -r -o $@ --start-group $(ramstage-objs) $(ramstage-libs) $(LIBGCC_FILE_NAME_ramstage) --end-group + $(CC_ramstage) $(CFLAGS_ramstage) -Wl,-nostdlib -r -o $@ -Wl,--start-group $(ramstage-objs) $(ramstage-libs) -Wl,--end-group else $(CC_ramstage) $(CFLAGS_ramstage) -nostdlib -r -o $@ -Wl,--wrap,__divdi3 -Wl,--wrap,__udivdi3 -Wl,--wrap,__moddi3 -Wl,--wrap,__umoddi3 -Wl,--start-group $(ramstage-objs) $(ramstage-libs) $(LIBGCC_FILE_NAME_ramstage) -Wl,--end-group endif