summaryrefslogtreecommitdiff
path: root/src/arch/x86/Makefile.mk
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2024-07-19 09:41:30 +0200
committerFelix Held <felix-coreboot@felixheld.de>2024-08-22 13:57:47 +0000
commit7bb8de184338453cde924c816e027af5eae40d32 (patch)
tree3d62385704091171df525629f2061351466dbe49 /src/arch/x86/Makefile.mk
parentcb26ed489c67b58bc981a57d032969355850cbd6 (diff)
Makefile.mk: Add a common link_stage function and use it
A few differences with the original link targets: - 'libs' is now supported on all arch even though only x86 uses it - compiler_rt is included on arch that previously did not (arm). This however has no impact as there compiler_rt is not defined for those arch in xcompile - LIBGCC_FILE_NAME_bootblock is not included, but this was not defined anywhere so this is a noop Change-Id: I64f7686894c99732d06972e7ba327061db6d7c44 Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/83574 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.mk22
1 files changed, 5 insertions, 17 deletions
diff --git a/src/arch/x86/Makefile.mk b/src/arch/x86/Makefile.mk
index 0a0d9c320b..43c7bd4a1f 100644
--- a/src/arch/x86/Makefile.mk
+++ b/src/arch/x86/Makefile.mk
@@ -51,18 +51,6 @@ pci$(stripped_vgabios_dgpu_id).rom-align := 64
endif # CONFIG_SOC_AMD_COMMON_BLOCK_LPC_SPI_DMA
###############################################################################
-# common support for early assembly includes
-###############################################################################
-
-define x86_stage
-# $1 stage name
-
-$$(objcbfs)/$(1).debug: $$$$($(1)-libs) $$$$($(1)-objs)
- @printf " LINK $$(subst $$(obj)/,,$$(@))\n"
- $$(LD_$(1)) $$(LDFLAGS_$(1)) -o $$@ -L$$(obj) $$(COMPILER_RT_FLAGS_$(1)) --whole-archive --start-group $$(filter-out %.ld,$$($(1)-objs)) $$($(1)-libs) --no-whole-archive $$(COMPILER_RT_$(1)) --end-group -T $(call src-to-obj,$(1),$(CONFIG_MEMLAYOUT_LD_FILE))
-endef
-
-###############################################################################
# bootblock
###############################################################################
@@ -90,7 +78,7 @@ bootblock-y += car.ld
$(call src-to-obj,bootblock,$(dir)/id.S): $(obj)/build.h
-$(eval $(call x86_stage,bootblock))
+$(eval $(call link_stage,bootblock))
ifeq ($(CONFIG_BOOTBLOCK_IN_CBFS),y)
add_bootblock = \
@@ -139,7 +127,7 @@ verstage-y += car.ld
verstage-libs ?=
-$(eval $(call x86_stage,verstage))
+$(eval $(call link_stage,verstage))
endif # CONFIG_ARCH_VERSTAGE_X86_32 / CONFIG_ARCH_VERSTAGE_X86_64
@@ -174,7 +162,7 @@ romstage-y += car.ld
romstage-srcs += $(wildcard $(src)/mainboard/$(MAINBOARDDIR)/romstage.c)
romstage-libs ?=
-$(eval $(call x86_stage,romstage))
+$(eval $(call link_stage,romstage))
# Compiling crt0 with -g seems to trigger https://sourceware.org/bugzilla/show_bug.cgi?id=6428
romstage-S-ccopts += -g0
@@ -212,7 +200,7 @@ postcar-$(CONFIG_HAVE_CF9_RESET) += cf9_reset.c
LDFLAGS_postcar += -Map $(objcbfs)/postcar.map
-$(eval $(call x86_stage,postcar))
+$(eval $(call link_stage,postcar))
$(objcbfs)/postcar.elf: $(objcbfs)/postcar.debug.rmod
cp $< $@
@@ -291,7 +279,7 @@ endif
ramstage-libs ?=
-$(eval $(call x86_stage,ramstage))
+$(eval $(call link_stage,ramstage))
$(objcbfs)/ramstage.elf: $(objcbfs)/ramstage.debug.rmod
cp $< $@