summaryrefslogtreecommitdiff
path: root/src/arch/x86/Makefile.mk
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2023-01-13 14:07:15 +0100
committerFelix Held <felix-coreboot@felixheld.de>2024-07-24 00:26:23 +0000
commit47254261ba1de104e57fb5bd8d6a2590cf348489 (patch)
tree9259d99e0a2d173e829a12827809aeaf8163ff74 /src/arch/x86/Makefile.mk
parent42b695510a85cde9a73e4f682dda966c465040b1 (diff)
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>
Diffstat (limited to 'src/arch/x86/Makefile.mk')
-rw-r--r--src/arch/x86/Makefile.mk12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/arch/x86/Makefile.mk b/src/arch/x86/Makefile.mk
index 2bd4338715..f19866c274 100644
--- a/src/arch/x86/Makefile.mk
+++ b/src/arch/x86/Makefile.mk
@@ -288,11 +288,9 @@ rmodules_x86_64-y += memset.c
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 @@ ramstage-libs ?=
$(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