arch/x86: Move oformat definition into the linker file
This removes the boilerplate --oformat out of the makefile.mk Change-Id: Ib78934fff4a31c4375da2038efca5027b813b07b Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/83999 Reviewed-by: Elyes Haouas <ehaouas@noos.fr> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
This commit is contained in:
committed by
Felix Held
parent
89869144bf
commit
cb26ed489c
@ -56,11 +56,10 @@ endif # CONFIG_SOC_AMD_COMMON_BLOCK_LPC_SPI_DMA
|
||||
|
||||
define x86_stage
|
||||
# $1 stage name
|
||||
# $2 oformat
|
||||
|
||||
$$(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)) --oformat $(2)
|
||||
$$(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
|
||||
|
||||
###############################################################################
|
||||
@ -91,11 +90,7 @@ bootblock-y += car.ld
|
||||
|
||||
$(call src-to-obj,bootblock,$(dir)/id.S): $(obj)/build.h
|
||||
|
||||
ifeq ($(CONFIG_ARCH_BOOTBLOCK_X86_32),y)
|
||||
$(eval $(call x86_stage,bootblock,elf32-i386))
|
||||
else
|
||||
$(eval $(call x86_stage,bootblock,elf64-x86-64))
|
||||
endif
|
||||
$(eval $(call x86_stage,bootblock))
|
||||
|
||||
ifeq ($(CONFIG_BOOTBLOCK_IN_CBFS),y)
|
||||
add_bootblock = \
|
||||
@ -144,11 +139,7 @@ verstage-y += car.ld
|
||||
|
||||
verstage-libs ?=
|
||||
|
||||
ifeq ($(CONFIG_ARCH_VERSTAGE_X86_32),y)
|
||||
$(eval $(call x86_stage,verstage,elf32-i386))
|
||||
else
|
||||
$(eval $(call x86_stage,verstage,elf64-x86-64))
|
||||
endif
|
||||
$(eval $(call x86_stage,verstage))
|
||||
|
||||
endif # CONFIG_ARCH_VERSTAGE_X86_32 / CONFIG_ARCH_VERSTAGE_X86_64
|
||||
|
||||
@ -183,11 +174,7 @@ romstage-y += car.ld
|
||||
romstage-srcs += $(wildcard $(src)/mainboard/$(MAINBOARDDIR)/romstage.c)
|
||||
romstage-libs ?=
|
||||
|
||||
ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32),y)
|
||||
$(eval $(call x86_stage,romstage,elf32-i386))
|
||||
else
|
||||
$(eval $(call x86_stage,romstage,elf64-x86-64))
|
||||
endif
|
||||
$(eval $(call x86_stage,romstage))
|
||||
|
||||
# Compiling crt0 with -g seems to trigger https://sourceware.org/bugzilla/show_bug.cgi?id=6428
|
||||
romstage-S-ccopts += -g0
|
||||
@ -225,11 +212,7 @@ postcar-$(CONFIG_HAVE_CF9_RESET) += cf9_reset.c
|
||||
|
||||
LDFLAGS_postcar += -Map $(objcbfs)/postcar.map
|
||||
|
||||
ifeq ($(CONFIG_ARCH_POSTCAR_X86_32),y)
|
||||
$(eval $(call x86_stage,postcar,elf32-i386))
|
||||
else
|
||||
$(eval $(call x86_stage,postcar,elf64-x86-64))
|
||||
endif
|
||||
$(eval $(call x86_stage,postcar))
|
||||
|
||||
$(objcbfs)/postcar.elf: $(objcbfs)/postcar.debug.rmod
|
||||
cp $< $@
|
||||
@ -308,11 +291,7 @@ endif
|
||||
|
||||
ramstage-libs ?=
|
||||
|
||||
ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y)
|
||||
$(eval $(call x86_stage,ramstage,elf32-i386))
|
||||
else
|
||||
$(eval $(call x86_stage,ramstage,elf64-x86-64))
|
||||
endif
|
||||
$(eval $(call x86_stage,ramstage))
|
||||
|
||||
$(objcbfs)/ramstage.elf: $(objcbfs)/ramstage.debug.rmod
|
||||
cp $< $@
|
||||
|
@ -1,5 +1,13 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
|
||||
#if ENV_X86_64
|
||||
OUTPUT_FORMAT(elf64-x86-64)
|
||||
OUTPUT_ARCH(i386:x86-64)
|
||||
#else
|
||||
OUTPUT_FORMAT(elf32-i386)
|
||||
OUTPUT_ARCH(i386)
|
||||
#endif
|
||||
|
||||
PHDRS
|
||||
{
|
||||
to_load PT_LOAD;
|
||||
|
Reference in New Issue
Block a user