[PATCH 01/10] Makefile: v2 Allow LTO to be disabled for a build

Andrew Scull ascull at google.com
Sun May 15 20:52:53 CEST 2022


On Mon, 11 Apr 2022 at 22:46, Simon Glass <sjg at chromium.org> wrote:
>
> Hi Andrew,
>
> 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:
>
> https://source.denx.de/u-boot/custodians/u-boot-dm/-/commit/2d4ebfb0e8e86a1b347e6cbd4dbec9a4eb745bd5

I realised my make command was rebuilding the defconfig each time
which, unsurprisingly, was regenerating the .config file. Now I can
unset CONFIG_LTO in .config and have it persist for incremental
builds, which is a pattern I've also used when working on Linux, and
doesn't need an alternate toggle in the makefiles to achieve the same
result. My preference is to use .config for the time being.


More information about the U-Boot-Custodians mailing list