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>
This commit is contained in:
committed by
Felix Held
parent
42b695510a
commit
47254261ba
@@ -288,11 +288,9 @@ rmodules_x86_64-y += memset.c
|
|||||||
|
|
||||||
ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y)
|
ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y)
|
||||||
target-objcopy=-O elf32-i386 -B i386
|
target-objcopy=-O elf32-i386 -B i386
|
||||||
LD_MACHINE =-m elf_i386
|
|
||||||
endif
|
endif
|
||||||
ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_64),y)
|
ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_64),y)
|
||||||
target-objcopy=-O elf64-x86-64 -B i386:x86-64
|
target-objcopy=-O elf64-x86-64 -B i386:x86-64
|
||||||
LD_MACHINE =-m elf_x86_64
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Make sure generated code does not use XMMx and MMx registers
|
# Make sure generated code does not use XMMx and MMx registers
|
||||||
@@ -315,13 +313,9 @@ ramstage-libs ?=
|
|||||||
$(objcbfs)/ramstage.elf: $(objcbfs)/ramstage.debug.rmod
|
$(objcbfs)/ramstage.elf: $(objcbfs)/ramstage.debug.rmod
|
||||||
cp $< $@
|
cp $< $@
|
||||||
|
|
||||||
$(objcbfs)/ramstage.debug: $(objgenerated)/ramstage.o $(call src-to-obj,ramstage,$(CONFIG_MEMLAYOUT_LD_FILE))
|
$(objcbfs)/ramstage.debug: $$(ramstage-objs) $(COMPILER_RT_ramstage) $(call src-to-obj,ramstage,$(CONFIG_MEMLAYOUT_LD_FILE)) $$(ramstage-libs)
|
||||||
@printf " CC $(subst $(obj)/,,$(@))\n"
|
@printf " LINK $(subst $(obj)/,,$(@))\n"
|
||||||
$(LD_ramstage) $(LDFLAGS_ramstage) -o $@ -L$(obj) $< -T $(call src-to-obj,ramstage,$(CONFIG_MEMLAYOUT_LD_FILE))
|
$(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))
|
||||||
|
|
||||||
$(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
|
|
||||||
|
|
||||||
endif # CONFIG_ARCH_RAMSTAGE_X86_32 / CONFIG_ARCH_RAMSTAGE_X86_64
|
endif # CONFIG_ARCH_RAMSTAGE_X86_32 / CONFIG_ARCH_RAMSTAGE_X86_64
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user