coreboot-kgpe-d16/payloads
Jacob Garber 04540f1549 libpayload: Add support for link time optimization
Link time optimization is a technique for whole-program optimization.
Instead of doing code generation during compilation, the compiler saves
its intermediate representation to the object files. During the final
linking step, it will then merge all the object files together and
perform optimizations on the entire program. This can often reduce the
final binary size, but also may increase the total compilation time.

This patch introduces a Kconfig option for enabling link time
optimization in libpayload. Since libpayload does no linking of its own,
its LTO archive files will contain only IR and no generated code.
Downstream projects will need to use LTO-aware tools when manipulating
the archives (eg. gcc-ar and gcc-nm), but otherwise do not need to use
LTO themselves -- the compiler will recognize which files are LTO and
which are not, so enabling this option should mostly be "drop in".

For example, when building coreinfo.elf using tinycurses libpayload:

		binary size	compilation time
default		114 KiB		11.49s
LTO		95 KiB		10.36s

In this case the total compilation time was actually shorter -- despite
the final linking step taking longer, this was offset by the shorter
compilation times for each individual file (since there is no code gen
until the very end).

Change-Id: I048f2ff6298ed0d891098942e1e8b29d35487b91
Signed-off-by: Jacob Garber <jgarber1@ualberta.ca>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/38291
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Martin Roth <martinroth@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-11-02 22:05:02 +00:00
..
coreinfo .gitignore: Split into subdirectory files 2020-10-30 07:05:27 +00:00
external .gitignore: Split into subdirectory files 2020-10-30 07:05:27 +00:00
libpayload libpayload: Add support for link time optimization 2020-11-02 22:05:02 +00:00
linuxcheck treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
nvramcui .gitignore: Split into subdirectory files 2020-10-30 07:05:27 +00:00
Kconfig arch/arm: Enable FIT payloads 2020-08-19 07:16:59 +00:00
Makefile.inc treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00