summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2024-02-22 15:01:04 +0100
committerArthur Heymans <arthur@aheymans.xyz>2024-02-26 10:10:07 +0000
commit7fbef1b1121bd1073cdbe4c45f7e544921fb8b42 (patch)
tree3ad8909a10f740fd2c45bb4def11c48f3ae232e3
parent259fc2b1190f23af085773a23a9c79209d3394c4 (diff)
lib: Remove heap from rmodules
No rmodule was using heap. Change-Id: I0bc049a5231dabbec1c962a99ef875eddcc4ac6e Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/80733 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
-rw-r--r--src/cpu/x86/Makefile.mk2
-rw-r--r--src/cpu/x86/smm/Makefile.mk9
-rw-r--r--src/include/rules.h4
-rw-r--r--src/lib/Makefile.mk9
-rw-r--r--src/lib/program.ld2
5 files changed, 12 insertions, 14 deletions
diff --git a/src/cpu/x86/Makefile.mk b/src/cpu/x86/Makefile.mk
index 9e9b837417..26e5d9c9c2 100644
--- a/src/cpu/x86/Makefile.mk
+++ b/src/cpu/x86/Makefile.mk
@@ -59,7 +59,7 @@ rmodules_$(ARCH-$(TARGET_STAGE)-y)-$(CONFIG_PARALLEL_MP) += sipi_vector.S
$(SIPI_DOTO): $(call src-to-obj,rmodules_$(ARCH-$(TARGET_STAGE)-y),src/cpu/x86/sipi_vector.S)
$(LD_rmodules_$(ARCH-$(TARGET_STAGE)-y)) -nostdlib -r -o $@ $^
-$(eval $(call rmodule_link,$(SIPI_ELF), $(SIPI_DOTO), 0,$(ARCH-$(TARGET_STAGE)-y)))
+$(eval $(call rmodule_link,$(SIPI_ELF), $(SIPI_DOTO),$(ARCH-$(TARGET_STAGE)-y)))
$(SIPI_BIN): $(SIPI_RMOD)
$(OBJCOPY_$(TARGET_STAGE)) -O binary $< $@
diff --git a/src/cpu/x86/smm/Makefile.mk b/src/cpu/x86/smm/Makefile.mk
index dbe9c75262..33b24a87f2 100644
--- a/src/cpu/x86/smm/Makefile.mk
+++ b/src/cpu/x86/smm/Makefile.mk
@@ -49,11 +49,10 @@ ramstage-srcs += $(obj)/cpu/x86/smm/smmstub.manual
$(obj)/smmstub/smmstub.o: $$(smmstub-objs) $(COMPILER_RT_smmstub)
$(LD_smmstub) -nostdlib -r -o $@ $(COMPILER_RT_FLAGS_smmstub) --whole-archive --start-group $(smmstub-objs) --no-whole-archive $(COMPILER_RT_smmstub) --end-group
-# Link the SMM stub module with a 0-byte heap.
ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y)
-$(eval $(call rmodule_link,$(obj)/smmstub/smmstub.elf, $(obj)/smmstub/smmstub.o, 0,x86_32))
+$(eval $(call rmodule_link,$(obj)/smmstub/smmstub.elf, $(obj)/smmstub/smmstub.o,x86_32))
else
-$(eval $(call rmodule_link,$(obj)/smmstub/smmstub.elf, $(obj)/smmstub/smmstub.o, 0,x86_64))
+$(eval $(call rmodule_link,$(obj)/smmstub/smmstub.elf, $(obj)/smmstub/smmstub.o,x86_64))
endif
$(obj)/smmstub/smmstub: $(obj)/smmstub/smmstub.elf.rmod
@@ -66,9 +65,9 @@ $(call src-to-obj,ramstage,$(obj)/cpu/x86/smm/smmstub.manual): $(obj)/smmstub/sm
# C-based SMM handler.
ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y)
-$(eval $(call rmodule_link,$(obj)/smm/smm.elf, $(obj)/smm/smm.o, 0,x86_32))
+$(eval $(call rmodule_link,$(obj)/smm/smm.elf, $(obj)/smm/smm.o,x86_32))
else
-$(eval $(call rmodule_link,$(obj)/smm/smm.elf, $(obj)/smm/smm.o, 0,x86_64))
+$(eval $(call rmodule_link,$(obj)/smm/smm.elf, $(obj)/smm/smm.o,x86_64))
endif
$(obj)/smm/smm: $(obj)/smm/smm.elf.rmod
diff --git a/src/include/rules.h b/src/include/rules.h
index 04b0a8229e..1005058b48 100644
--- a/src/include/rules.h
+++ b/src/include/rules.h
@@ -282,8 +282,8 @@
* arch/x86/car.ld */
#define ENV_SEPARATE_DATA_AND_BSS (ENV_CACHE_AS_RAM && (ENV_BOOTBLOCK || !CONFIG(NO_XIP_EARLY_STAGES)))
-/* Currently rmodules and ramstage have heap. */
-#define ENV_HAS_HEAP_SECTION (ENV_RMODULE || ENV_RAMSTAGE)
+/* Currently ramstage has heap. */
+#define ENV_HAS_HEAP_SECTION ENV_RAMSTAGE
/* Set USER_SPACE in the makefile for the rare code that runs in userspace */
#if defined(__USER_SPACE__)
diff --git a/src/lib/Makefile.mk b/src/lib/Makefile.mk
index fe24156dad..e22fd08723 100644
--- a/src/lib/Makefile.mk
+++ b/src/lib/Makefile.mk
@@ -310,14 +310,13 @@ RMODULE_LDFLAGS := -z defs -Bsymbolic
# rmodule_link_rules is a function that should be called with:
# (1) the object name to link
# (2) the dependencies
-# (3) heap size of the relocatable module
-# (4) arch for which the rmodules are to be linked
+# (3) arch for which the rmodules are to be linked
# It will create the necessary Make rules to create a rmodule. The resulting
# rmdoule is named $(1).rmod
define rmodule_link
-$(strip $(1)): $(strip $(2)) $$(COMPILER_RT_rmodules_$(4)) $(call src-to-obj,rmodules_$(4),src/lib/rmodule.ld) | $$(RMODTOOL)
- $$(LD_rmodules_$(4)) $$(LDFLAGS_rmodules_$(4)) $(RMODULE_LDFLAGS) $($(1)-ldflags) -T $(call src-to-obj,rmodules_$(4),src/lib/rmodule.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)): $(strip $(2)) $$(COMPILER_RT_rmodules_$(3)) $(call src-to-obj,rmodules_$(3),src/lib/rmodule.ld) | $$(RMODTOOL)
+ $$(LD_rmodules_$(3)) $$(LDFLAGS_rmodules_$(3)) $(RMODULE_LDFLAGS) $($(1)-ldflags) -T $(call src-to-obj,rmodules_$(3),src/lib/rmodule.ld) -o $$@ --whole-archive --start-group $(filter-out %.ld,$(2)) --end-group
+ $$(NM_rmodules_$(3)) -n $$@ > $$(basename $$@).map
endef
endif
diff --git a/src/lib/program.ld b/src/lib/program.ld
index 68bcab6405..21f4be8d32 100644
--- a/src/lib/program.ld
+++ b/src/lib/program.ld
@@ -134,7 +134,7 @@
.heap . : {
. = ALIGN(ARCH_POINTER_ALIGN_SIZE);
_heap = .;
- . += (ENV_RMODULE ? __heap_size : CONFIG_HEAP_SIZE);
+ . += CONFIG_HEAP_SIZE;
. = ALIGN(ARCH_POINTER_ALIGN_SIZE);
_eheap = .;
RECORD_SIZE(heap)