Enable compilation with -fwhole-program for initram. The setting can be chosen via Kconfig. Default off. Depending on the target, this saves between 10% and 20% of initram size.
Compilation still broken for: - ADL MSM800SEV - Gigabyte M57SLI
Compilation changed for: - AMD DB800 (checker doesn't trigger anymore, but we get an unresolved symbol instead) - AMD Norwich (same) (The compilation changes are not bad per se, just a bit misleading. It seems that gcc is really smart.)
Compilation OK for: - AMD Serengeti - Artec DBE61 - Artec DBE62 - PCEngines Alix.1C - PCEngines Alix.2C3
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Index: corebootv3-initram_fwholeprogram/Kconfig =================================================================== --- corebootv3-initram_fwholeprogram/Kconfig (Revision 821) +++ corebootv3-initram_fwholeprogram/Kconfig (Arbeitskopie) @@ -60,6 +60,16 @@ help Enable this option to make coreboot beep upon certain events.
+config BADASS_OPTIMIZATION + bool "Enable badass optimizations" + depends EXPERT && EXPERIMENTAL + help + Enable -fwhole-program -combine for select code. + Needs lots of annotation in stage1 and stage2. + Works for initram only. + + If you are a Gentoo user, say NO! + endmenu
source mainboard/Kconfig Index: corebootv3-initram_fwholeprogram/arch/x86/Makefile =================================================================== --- corebootv3-initram_fwholeprogram/arch/x86/Makefile (Revision 821) +++ corebootv3-initram_fwholeprogram/arch/x86/Makefile (Arbeitskopie) @@ -132,6 +132,12 @@ PARSEELF = -e endif
+ifeq ($(CONFIG_BADASS_OPTIMIZATION), y) + COMBINEFLAGS = -fwhole-program +else + COMBINEFLAGS = +endif + STAGE0_SRC := $(patsubst %,$(src)/lib/%,$(STAGE0_LIB_SRC)) \ $(patsubst %,$(src)/arch/x86/%,$(STAGE0_ARCH_X86_SRC)) \ $(STAGE0_MAINBOARD_SRC) $(STAGE0_CHIPSET_SRC) @@ -268,7 +274,7 @@
$(obj)/coreboot.initram $(obj)/coreboot.initram.map: $(obj)/stage0.init $(obj)/stage0-prefixed.o $(INITRAM_SRC) $(Q)printf " CC $(subst $(shell pwd)/,,$(@)) (XIP)\n" - $(Q)$(CC) $(INITCFLAGS) -fPIE -c -combine $(INITRAM_SRC) -o $(obj)/coreboot.initram_partiallylinked.o + $(Q)$(CC) $(INITCFLAGS) -fPIE -c -combine $(COMBINEFLAGS) $(INITRAM_SRC) -o $(obj)/coreboot.initram_partiallylinked.o
$(Q)# .data and .bss must be empty because they aren't handled $(Q)printf " CHECK initram (non-empty writable/allocatable sections)\n"