[coreboot-gerrit] New patch to review for coreboot: 4195b3a build: Allow clang build linkage to use libcompiler-rt

Edward O'Callaghan (eocallaghan@alterapraxis.com) gerrit at coreboot.org
Fri Jun 27 19:05:59 CEST 2014


Edward O'Callaghan (eocallaghan at alterapraxis.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6144

-gerrit

commit 4195b3a89764e06a3fc4e8f7b63db1d3a9f0e667
Author: Edward O'Callaghan <eocallaghan at alterapraxis.com>
Date:   Sat Jun 28 03:02:52 2014 +1000

    build: Allow clang build linkage to use libcompiler-rt
    
    NOTFORMERGE: (pending one more patch upstream)
    
    NOTE: *** Requires at least clang 3.5.0 r211866.
    
    Change-Id: I7f63284473d6067bf775409970c8dd98f5d5a8d5
    Signed-off-by: Edward O'Callaghan <eocallaghan at alterapraxis.com>
---
 Makefile                  | 4 +++-
 src/arch/x86/Makefile.inc | 6 +++---
 toolchain.inc             | 1 +
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 195bfe6..44913dc 100644
--- a/Makefile
+++ b/Makefile
@@ -109,7 +109,9 @@ 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
+# NOTE: clang puts compiler-rt under lib/linux/libclang_rt.builtins-i386.a
+# this means the triple is i386-linux-elf instead of i386-none-elf
+CFLAGS_x86_32 = -no-integrated-as -Qunused-arguments -target i386-linux-elf -m32
 CC_x86_32:=clang
 
 ifneq ($(CONFIG_MMX),y)
diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc
index c0e908d..251471b 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
+	$(LD_romstage) -nostdlib -nostartfiles -static -o $@ -L$(obj) --start-group $(romstage-objs) $(romstage-libs) $(LIBCLANG_RT_FILE_NAME_romstage) --end-group -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
+	$(LD_romstage) -nostdlib -nostartfiles -static -o $@ -L$(obj) --start-group $(romstage-objs) $(romstage-libs) $(LIBCLANG_RT_FILE_NAME_romstage) --end-group -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
+	$(LD_ramstage) -m elf_i386 -r -o $@ --start-group $(ramstage-objs) $(ramstage-libs) $(LIBCLANG_RT_FILE_NAME_ramstage) --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
diff --git a/toolchain.inc b/toolchain.inc
index 2375f17..de40978 100644
--- a/toolchain.inc
+++ b/toolchain.inc
@@ -98,6 +98,7 @@ READELF_$(1) := $(READELF_$(2))
 CFLAGS_$(1) = $$(CFLAGS_common) $$(CFLAGS_$(2))
 CPPFLAGS_$(1) = $$(CPPFLAGS_common) $$(CPPFLAGS_$(2))
 LIBGCC_FILE_NAME_$(1) = $(wildcard $(shell $(CC_$(2)) $(CFLAGS_$(2)) -print-libgcc-file-name))
+LIBCLANG_RT_FILE_NAME_$(1) = $(shell $(CC_$(2)) $(CFLAGS_$(2)) -print-librt-file-name)
 endef
 
 # initialize standard toolchain (CC,AS and others) for give stage



More information about the coreboot-gerrit mailing list