[coreboot] use gcc 4.6.0 link time optimization to reduce coreboot execution time
stefan.reinauer at coreboot.org
Fri Apr 29 05:59:46 CEST 2011
On 4/28/11 8:01 PM, Scott Duplichan wrote:
> Adds a kconfig option to enable gcc link time optimization.
> Link time optimization reduces both rom stage and ram stage
> image size by removing unused functions and data. Reducing the
> image size saves boot time by minimizing the flash memory read
> and decompress time for ram stage.
> The option is off by default because of side effects such as
> long build time and unusable dwarf2 debug output. This
> option cuts persimmon+seabios DOS boot from SSD time from
> 690 ms to 640 ms.
Did you do some size tests with non-AGESA targets?
Does lto work with our "driver"s? I hoped that once we have LTO
available we could get rid of the distinction between drivers and
objects and handle everything the way we handle drivers now, letting gcc
remove the functions we don't need.
> Signed-off-by: Scott Duplichan<scott at notabs.org>
Should we instead probe for availability of -flto in
util/xcompile/xcompile and use it if it is there?
What's the problem with dwarf2? GCC 4.6 uses mostly dwarf4 unless you
manually force it to dwarf2. Will this still be a problem?
> Index: Makefile
> --- Makefile (revision 6549)
> +++ Makefile (working copy)
> @@ -211,7 +211,7 @@
> de$(EMPTY)fine $(1)-objs_$(2)_template
> $(obj)/$$(1).$(1).o: src/$$(1).$(2) $(obj)/config.h $(4)
> @printf " CC $$$$(subst $$$$(obj)/,,$$$$(@))\n"
> - $(CC) $(3) -MMD $$$$(CFLAGS) -c -o $$$$@ $$$$<
> + $(CC) $(3) -MMD $$$$(CFLAGS) $$$$(LTO_OPTIMIZE) -c -o $$$$@ $$$$<
Hm.. I think LTO_OPTIMIZE should be added to CFLAGS instead, that would
make the patch a whole lot less intrusive.
> Index: src/arch/x86/init/bootblock.ld
> --- src/arch/x86/init/bootblock.ld (revision 6549)
> +++ src/arch/x86/init/bootblock.ld (working copy)
> @@ -22,7 +22,6 @@
> OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
> . = CONFIG_ROMBASE;
Hm interesting... does this hurt LTO?
More information about the coreboot