Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/71910?usp=email )
Change subject: arch/x86: Link ramstage in one step ......................................................................
arch/x86: Link ramstage in one step
We only use the bfd linker currently but partial linking is not supported by other linkers and is also a problem for LTO.
Change-Id: I3b23d86e604229262d7c762e23bb963a0e944b5d Signed-off-by: Arthur Heymans arthur@aheymans.xyz Reviewed-on: https://review.coreboot.org/c/coreboot/+/71910 Reviewed-by: Jérémy Compostella jeremy.compostella@intel.com Reviewed-by: Nico Huber nico.h@gmx.de Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M src/arch/x86/Makefile.mk 1 file changed, 3 insertions(+), 9 deletions(-)
Approvals: Nico Huber: Looks good to me, approved build bot (Jenkins): Verified Jérémy Compostella: Looks good to me, but someone else must approve
diff --git a/src/arch/x86/Makefile.mk b/src/arch/x86/Makefile.mk index 2bd4338..f19866c 100644 --- a/src/arch/x86/Makefile.mk +++ b/src/arch/x86/Makefile.mk @@ -288,11 +288,9 @@
ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y) target-objcopy=-O elf32-i386 -B i386 -LD_MACHINE =-m elf_i386 endif ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_64),y) target-objcopy=-O elf64-x86-64 -B i386:x86-64 -LD_MACHINE =-m elf_x86_64 endif
# Make sure generated code does not use XMMx and MMx registers @@ -315,13 +313,9 @@ $(objcbfs)/ramstage.elf: $(objcbfs)/ramstage.debug.rmod cp $< $@
-$(objcbfs)/ramstage.debug: $(objgenerated)/ramstage.o $(call src-to-obj,ramstage,$(CONFIG_MEMLAYOUT_LD_FILE)) - @printf " CC $(subst $(obj)/,,$(@))\n" - $(LD_ramstage) $(LDFLAGS_ramstage) -o $@ -L$(obj) $< -T $(call src-to-obj,ramstage,$(CONFIG_MEMLAYOUT_LD_FILE)) - -$(objgenerated)/ramstage.o: $$(ramstage-objs) $(COMPILER_RT_ramstage) $$(ramstage-libs) - @printf " CC $(subst $(obj)/,,$(@))\n" - $(LD_ramstage) $(LD_MACHINE) -r -o $@ $(COMPILER_RT_FLAGS_ramstage) --whole-archive --start-group $(filter-out %.ld,$(ramstage-objs)) $(ramstage-libs) --no-whole-archive $(COMPILER_RT_ramstage) --end-group +$(objcbfs)/ramstage.debug: $$(ramstage-objs) $(COMPILER_RT_ramstage) $(call src-to-obj,ramstage,$(CONFIG_MEMLAYOUT_LD_FILE)) $$(ramstage-libs) + @printf " LINK $(subst $(obj)/,,$(@))\n" + $(LD_ramstage) $(LDFLAGS_ramstage) -o $@ -L$(obj) $(COMPILER_RT_FLAGS_ramstage) --whole-archive --start-group $(filter-out %.ld,$^) --no-whole-archive $(COMPILER_RT_ramstage) --end-group -T $(call src-to-obj,ramstage,$(CONFIG_MEMLAYOUT_LD_FILE))
endif # CONFIG_ARCH_RAMSTAGE_X86_32 / CONFIG_ARCH_RAMSTAGE_X86_64