summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2024-07-18 21:53:23 +0200
committerFelix Held <felix-coreboot@felixheld.de>2024-07-24 00:28:31 +0000
commit9b99eb5cf8c33ed40041629f1f2784cdf67057e7 (patch)
tree2e42c9d5be3d5d863272fb692b97e802f84a5139 /src/arch
parent47254261ba1de104e57fb5bd8d6a2590cf348489 (diff)
arch/x86: Build all stages using the same function
There is no difference in how early and later stages are linked so rename the same function. Change-Id: I458c7c6822b310847e7ab32519fd8d66a90f88f7 Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/83562 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Jérémy Compostella <jeremy.compostella@intel.com>
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/x86/Makefile.mk33
1 files changed, 18 insertions, 15 deletions
diff --git a/src/arch/x86/Makefile.mk b/src/arch/x86/Makefile.mk
index f19866c274..cf5b2bbb57 100644
--- a/src/arch/x86/Makefile.mk
+++ b/src/arch/x86/Makefile.mk
@@ -54,7 +54,7 @@ endif # CONFIG_SOC_AMD_COMMON_BLOCK_LPC_SPI_DMA
# common support for early assembly includes
###############################################################################
-define early_x86_stage
+define x86_stage
# $1 stage name
# $2 oformat
@@ -95,9 +95,9 @@ bootblock-y += car.ld
$(call src-to-obj,bootblock,$(dir)/id.S): $(obj)/build.h
ifeq ($(CONFIG_ARCH_BOOTBLOCK_X86_32),y)
-$(eval $(call early_x86_stage,bootblock,elf32-i386))
+$(eval $(call x86_stage,bootblock,elf32-i386))
else
-$(eval $(call early_x86_stage,bootblock,elf64-x86-64))
+$(eval $(call x86_stage,bootblock,elf64-x86-64))
endif
ifeq ($(CONFIG_BOOTBLOCK_IN_CBFS),y)
@@ -148,9 +148,9 @@ verstage-y += car.ld
verstage-libs ?=
ifeq ($(CONFIG_ARCH_VERSTAGE_X86_32),y)
-$(eval $(call early_x86_stage,verstage,elf32-i386))
+$(eval $(call x86_stage,verstage,elf32-i386))
else
-$(eval $(call early_x86_stage,verstage,elf64-x86-64))
+$(eval $(call x86_stage,verstage,elf64-x86-64))
endif
endif # CONFIG_ARCH_VERSTAGE_X86_32 / CONFIG_ARCH_VERSTAGE_X86_64
@@ -187,9 +187,9 @@ romstage-srcs += $(wildcard $(src)/mainboard/$(MAINBOARDDIR)/romstage.c)
romstage-libs ?=
ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32),y)
-$(eval $(call early_x86_stage,romstage,elf32-i386))
+$(eval $(call x86_stage,romstage,elf32-i386))
else
-$(eval $(call early_x86_stage,romstage,elf64-x86-64))
+$(eval $(call x86_stage,romstage,elf64-x86-64))
endif
# Compiling crt0 with -g seems to trigger https://sourceware.org/bugzilla/show_bug.cgi?id=6428
@@ -228,9 +228,11 @@ postcar-$(CONFIG_HAVE_CF9_RESET) += cf9_reset.c
LDFLAGS_postcar += -Map $(objcbfs)/postcar.map
-$(objcbfs)/postcar.debug: $$(postcar-objs)
- @printf " LINK $(subst $(obj)/,,$(@))\n"
- $(LD_postcar) $(LDFLAGS_postcar) -o $@ -L$(obj) $(COMPILER_RT_FLAGS_postcar) --whole-archive --start-group $(filter-out %.ld,$^) --no-whole-archive $(COMPILER_RT_postcar) --end-group -T $(call src-to-obj,postcar,$(CONFIG_MEMLAYOUT_LD_FILE))
+ifeq ($(CONFIG_ARCH_POSTCAR_X86_32),y)
+$(eval $(call x86_stage,postcar,elf32-i386))
+else
+$(eval $(call x86_stage,postcar,elf64-x86-64))
+endif
$(objcbfs)/postcar.elf: $(objcbfs)/postcar.debug.rmod
cp $< $@
@@ -309,14 +311,15 @@ endif
ramstage-libs ?=
-# The rmodule_link definition creates an elf file with .rmod extension.
+ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y)
+$(eval $(call x86_stage,ramstage,elf32-i386))
+else
+$(eval $(call x86_stage,ramstage,elf64-x86-64))
+endif
+
$(objcbfs)/ramstage.elf: $(objcbfs)/ramstage.debug.rmod
cp $< $@
-$(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
smm-$(CONFIG_DEBUG_HW_BREAKPOINTS_IN_ALL_STAGES) += breakpoint.c