summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/arch/x86/Makefile.inc10
-rw-r--r--src/lib/Makefile.inc9
-rw-r--r--src/lib/program.ld6
3 files changed, 10 insertions, 15 deletions
diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc
index 3d1d214984..68ed810c27 100644
--- a/src/arch/x86/Makefile.inc
+++ b/src/arch/x86/Makefile.inc
@@ -282,17 +282,11 @@ ramstage-libs ?=
ifeq ($(CONFIG_RELOCATABLE_RAMSTAGE),y)
-ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y)
-$(eval $(call rmodule_link,$(objcbfs)/ramstage.debug, $(objgenerated)/ramstage.o, $(CONFIG_HEAP_SIZE),x86_32))
-else
-$(eval $(call rmodule_link,$(objcbfs)/ramstage.debug, $(objgenerated)/ramstage.o, $(CONFIG_HEAP_SIZE),x86_64))
-endif
-
# The rmodule_link defintion creates an elf file with .rmod extension.
$(objcbfs)/ramstage.elf: $(objcbfs)/ramstage.debug.rmod
cp $< $@
-else
+endif
ramstage-y += memlayout.ld
@@ -300,8 +294,6 @@ $(objcbfs)/ramstage.debug: $(objgenerated)/ramstage.o $(obj)/arch/x86/memlayout.
@printf " CC $(subst $(obj)/,,$(@))\n"
$(LD_ramstage) $(CPPFLAGS) $(LDFLAGS_ramstage) -o $@ -L$(obj) $< -T $(obj)/arch/x86/memlayout.ramstage.ld
-endif
-
$(objgenerated)/ramstage.o: $$(ramstage-objs) $(COMPILER_RT_ramstage) $$(ramstage-libs)
@printf " CC $(subst $(obj)/,,$(@))\n"
ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32),y)
diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc
index a89f7d4018..f4d8c2c2ea 100644
--- a/src/lib/Makefile.inc
+++ b/src/lib/Makefile.inc
@@ -218,9 +218,12 @@ define rmodule_link
$(strip $(1)): $(strip $(2)) $$(COMPILER_RT_rmodules_$(4)) $(obj)/lib/rmodule.rmodules_$(4).ld | $$(RMODTOOL)
$$(LD_rmodules_$(4)) $$(LDFLAGS_rmodules_$(4)) $(RMODULE_LDFLAGS) -T $(obj)/lib/rmodule.rmodules_$(4).ld --defsym=__heap_size=$(strip $(3)) -o $$@ --whole-archive --start-group $(filter-out %.ld,$(2)) --end-group
$$(NM_rmodules_$(4)) -n $$@ > $$(basename $$@).map
-
-$(strip $(1)).rmod: $(strip $(1))
- $$(RMODTOOL) -i $$^ -o $$@
endef
endif
+
+$(objcbfs)/%.debug.rmod: $(objcbfs)/%.debug | $(RMODTOOL)
+ $(RMODTOOL) -i $< -o $@
+
+$(obj)/%.elf.rmod: $(obj)/%.elf | $(RMODTOOL)
+ $(RMODTOOL) -i $< -o $@
diff --git a/src/lib/program.ld b/src/lib/program.ld
index d6e3e54c09..9f28d659f3 100644
--- a/src/lib/program.ld
+++ b/src/lib/program.ld
@@ -38,14 +38,14 @@
*(.text);
*(.text.*);
-#if ENV_RAMSTAGE || ENV_ROMSTAGE || ENV_RMODULE
+#if ENV_RAMSTAGE || ENV_ROMSTAGE
. = ALIGN(ARCH_POINTER_ALIGN_SIZE);
_cbmem_init_hooks = .;
KEEP(*(.rodata.cbmem_init_hooks));
_ecbmem_init_hooks = .;
#endif
-#if ENV_RAMSTAGE || ENV_RMODULE
+#if ENV_RAMSTAGE
. = ALIGN(ARCH_POINTER_ALIGN_SIZE);
_pci_drivers = .;
KEEP(*(.rodata.pci_driver));
@@ -92,7 +92,7 @@
#ifdef __PRE_RAM__
PROVIDE(_preram_cbmem_console = .);
PROVIDE(_epreram_cbmem_console = _preram_cbmem_console);
-#elif ENV_RAMSTAGE || ENV_RMODULE
+#elif ENV_RAMSTAGE
. = ALIGN(ARCH_POINTER_ALIGN_SIZE);
_bs_init_begin = .;
KEEP(*(.bs_init));