From 282ffb535a7c4a4b1a3327db98379a35b754cf14 Mon Sep 17 00:00:00 2001 From: Carl-Daniel Hailfinger Date: Wed, 27 Aug 2008 01:10:27 +0000 Subject: [PATCH] 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 4.2.x is really smart. gcc 4.3.x and later are even smarter and even fix compilation completely.) Compilation OK for: - AMD Serengeti - Artec DBE61 - Artec DBE62 - PCEngines Alix.1C - PCEngines Alix.2C3 - Signed-off-by: Carl-Daniel Hailfinger Acked-by: Ronald G. Minnich git-svn-id: svn://coreboot.org/repository/coreboot-v3@825 f3766cd6-281f-0410-b1cd-43a5c92072e9 --- Kconfig | 16 ++++++++++++++++ arch/x86/Makefile | 8 +++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Kconfig b/Kconfig index 67faadaf76..54ac6bb331 100644 --- a/Kconfig +++ b/Kconfig @@ -60,6 +60,22 @@ config BEEPS help Enable this option to make coreboot beep upon certain events. +config WHOLE_PROGRAM_COMPILE + bool "Enable whole-program optimizations (DANGEROUS)" + depends EXPERT && EXPERIMENTAL + help + Enable gcc -fwhole-program -combine for select code. + Needs lots of annotation in stage1 and stage2. + Works for initram only. + This increases compile time (no parallel compilation possible + anymore) and compiler memory usage (up to a factor of 20) and + makes debugging really hard. + + Requires at least gcc 4.2.x, but miscompilations may occur. + + Say No. + If you are a Gentoo user, say NO! + endmenu source mainboard/Kconfig diff --git a/arch/x86/Makefile b/arch/x86/Makefile index ac489a72a7..88683bd739 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -132,6 +132,12 @@ else PARSEELF = -e endif +ifeq ($(CONFIG_WHOLE_PROGRAM_COMPILE), 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)/arch/x86/amd/stage0.o: $(src)/arch/x86/amd/stage0.S $(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"