[PATCH 01/10] Makefile: v2 Allow LTO to be disabled for a build
sjg at chromium.org
Mon Apr 11 23:46:04 CEST 2022
On Thu, 31 Mar 2022 at 04:29, Andrew Scull <ascull at google.com> wrote:
> On Sun, 27 Mar 2022 at 21:27, Simon Glass <sjg at chromium.org> wrote:
> > LTO (Link-Time Optimisation) is an very useful feature which can
> > significantly reduce the size of U-Boot binaries. So far it has been
> > made available for selected ARM boards and sandbox.
> > However, incremental builds are much slower when LTO is used. For example,
> > an incremental build of sandbox takes 2.1 seconds on my machine, but 6.7
> > seconds with LTO enabled.
> This is something that has been bothering me too. I'd resorted to adding
> `# CONFIG_LTO is not set` to sandbox_defconfig because I couldn't work
> out how to stop .config being regenerated each build. But then the
> diff gets in the way and is difficult to manage.
> > Add a LTO_BUILD=n parameter to the build, so it can be disabled during
> > development if needed, for faster builds.
> If you go the build parameter route rather than config route to
> address this, could the flag be consistent e.g. with NO_SDL=1, which
> would mean NO_LTO=1?
That seems OK to me. Would you like to do that and send a new version?
Here is a better version of the patch to use as a starting point:
Tom, please consider dropping your objection to this. I have already
shown that it makes a dramatic difference to incremental build time
for any board...
> > Add some documentation about LTO while we are here.
> > Signed-off-by: Simon Glass <sjg at chromium.org>
> > ---
> > Makefile | 18 +++++++++++++-----
> > arch/arm/config.mk | 4 ++--
> > arch/arm/include/asm/global_data.h | 2 +-
> > doc/build/gcc.rst | 17 +++++++++++++++++
> > scripts/Makefile.spl | 2 +-
> > 5 files changed, 34 insertions(+), 9 deletions(-)
More information about the U-Boot-Custodians