[SeaBIOS] Experiences with link time optimization?
paulepanter at users.sourceforge.net
Fri Apr 25 00:06:57 CEST 2014
Dear SeaBIOS folks,
in #coreboot on <irc.freenode.net> Stefan mentioned that link time
optimization (LTO)  might yield some speed improvements for coreboot
as the resulting firmware image might be smaller and therefore it takes
less time to read it from flash. This was confirmed with coreboot and
GCC 4.6.0 in 2011 by Scott Duplichan .
The same is true for the payload. As LTO has been greatly improved in
GCC 4.9.0 and is currently all over the news, I wanted to build SeaBIOS
with LTO, but noticed that it already uses `-fwhole-program`. Reading
GCC’s online documentation , it says it should not be used in
combination with `-lto`.
Assume that the current compilation unit represents the whole
program being compiled. All public functions and variables with
the exception of main and those merged by attribute
externally_visible become static functions and in effect are
optimized more aggressively by interprocedural optimizers.
This option should not be used in combination with -flto.
Instead relying on a linker plugin should provide safer and more
Using GCC 4.8.2 from Debian Sid/unstable and just removing
`-fwhole-program` and adding `-lto` increased the resulting binary size
As I do not know a lot about compilers and linkers, could some expert
please comment, if `-fwhole-program` already optimizes the code the best
way possible for GCC and therefore LTO is not going to reduce SeaBIOS’
binary size? Unfortunately I did not yet try GCC 4.9.0, so I have no
idea if something improved in that version. And probably my hack was
(search for `lto`)
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 181 bytes
Desc: This is a digitally signed message part
More information about the SeaBIOS