diff options
-rw-r--r-- | src/arch/x86/Makefile.mk | 33 | ||||
-rw-r--r-- | src/arch/x86/include/arch/header.ld | 8 |
2 files changed, 14 insertions, 27 deletions
diff --git a/src/arch/x86/Makefile.mk b/src/arch/x86/Makefile.mk index 2832ac36f5..0a0d9c320b 100644 --- a/src/arch/x86/Makefile.mk +++ b/src/arch/x86/Makefile.mk @@ -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 $< $@ diff --git a/src/arch/x86/include/arch/header.ld b/src/arch/x86/include/arch/header.ld index 2ee021226c..d12c8039f9 100644 --- a/src/arch/x86/include/arch/header.ld +++ b/src/arch/x86/include/arch/header.ld @@ -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; |