src/lib/Makefile.inc: Allow rmodules to link under Clang

rmodules were getting linked with libgcc and not libcompiler-rt.
Unfortunately this is pretty ugly however we do this else where
in the build system so its consistently ugly. The build system
will later need a unification pass between compilers once we are
tree stable on Clang.

Change-Id: I380f7386de2c5adfa9036311323ad9f703b6e712
Signed-off-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-on: http://review.coreboot.org/7440
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Edward O'Callaghan 2014-11-12 11:55:19 +11:00
parent 9cb5a3af34
commit 5b5db8794f
1 changed files with 5 additions and 0 deletions

View File

@ -105,6 +105,7 @@ romstage-$(CONFIG_RELOCATABLE_RAMSTAGE) += rmodule.c
RMODULE_LDSCRIPT := $(src)/lib/rmodule.ld RMODULE_LDSCRIPT := $(src)/lib/rmodule.ld
RMODULE_LDFLAGS := -nostartfiles -Wl,--emit-relocs -Wl,-z,defs -Wl,-Bsymbolic -Wl,-T,$(RMODULE_LDSCRIPT) RMODULE_LDFLAGS := -nostartfiles -Wl,--emit-relocs -Wl,-z,defs -Wl,-Bsymbolic -Wl,-T,$(RMODULE_LDSCRIPT)
RMODULE_LDFLAGS_CLANG := -nostartfiles --emit-relocs -z defs -Bsymbolic -T$(RMODULE_LDSCRIPT)
# rmodule_link_rules is a function that should be called with: # rmodule_link_rules is a function that should be called with:
# (1) the object name to link # (1) the object name to link
@ -115,7 +116,11 @@ RMODULE_LDFLAGS := -nostartfiles -Wl,--emit-relocs -Wl,-z,defs -Wl,-Bsymbolic -
# rmdoule is named $(1).rmod # rmdoule is named $(1).rmod
define rmodule_link define rmodule_link
$(strip $(1)): $(strip $(2)) $$(RMODULE_LDSCRIPT) $$(obj)/ldoptions $$(RMODTOOL) $(strip $(1)): $(strip $(2)) $$(RMODULE_LDSCRIPT) $$(obj)/ldoptions $$(RMODTOOL)
ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y)
$$(LD_rmodules_$(4)) $$(RMODULE_LDFLAGS_CLANG) --defsym=__heap_size=$(strip $(3)) -o $$@ --start-group $(strip $(2)) $$(LIBCLANG_RT_FILE_NAME_rmodules_$(4)) --end-group
else
$$(CC_rmodules_$(4)) $$(CFLAGS_rmodules_$(4)) $$(RMODULE_LDFLAGS) -Wl,--defsym=__heap_size=$(strip $(3)) -o $$@ -Wl,--start-group $(strip $(2)) $$(LIBGCC_FILE_NAME_rmodules_$(4)) -Wl,--end-group $$(CC_rmodules_$(4)) $$(CFLAGS_rmodules_$(4)) $$(RMODULE_LDFLAGS) -Wl,--defsym=__heap_size=$(strip $(3)) -o $$@ -Wl,--start-group $(strip $(2)) $$(LIBGCC_FILE_NAME_rmodules_$(4)) -Wl,--end-group
endif
$$(NM_rmodules_$(4)) -n $$@ > $$(basename $$@).map $$(NM_rmodules_$(4)) -n $$@ > $$(basename $$@).map
$(strip $(1)).rmod: $(strip $(1)) $(strip $(1)).rmod: $(strip $(1))