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"