[PATCH v2 02/41] Makefile: Allow LTO to be disabled for a build

Simon Glass sjg at chromium.org
Mon Nov 1 00:45:51 CET 2021


Hi Heinrich,

On Wed, 27 Oct 2021 at 06:21, Heinrich Schuchardt
<heinrich.schuchardt at canonical.com> wrote:
>
>
>
> On 10/27/21 10:50, Ilias Apalodimas wrote:
> > Hi Simon
> >
> > How does this patch related to the standard boot series? Shouldn't
> > this be a completely separate patch?

Probably, but I lose track of all the branches in progress,
particularly when things sit for a while.

> >
> > Thanks
> > /Ilias
> >
> > On Sun, 24 Oct 2021 at 02:26, 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.
> >>
> >> Add a LTO_BUILD=n parameter to the build, so it can be disabled during
> >> development if needed, for faster builds.
> >>
> >> Add some documentation about LTO while we are here.
> >>
> >> Signed-off-by: Simon Glass <sjg at chromium.org>
> >> ---
> >>
> >> (no changes since v1)
> >>
> >>   Makefile                           | 18 +++++++++++++-----
> >>   arch/arm/config.mk                 |  4 ++--
> >>   arch/arm/include/asm/global_data.h |  2 +-
> >>   doc/build/gcc.rst                  | 17 +++++++++++++++++
> >>   4 files changed, 33 insertions(+), 8 deletions(-)
> >>
> >> diff --git a/Makefile b/Makefile
> >> index b79b2319ff6..7057723e046 100644
> >> --- a/Makefile
> >> +++ b/Makefile
> >> @@ -434,6 +434,9 @@ KBUILD_CFLAGS       += -fshort-wchar -fno-strict-aliasing
> >>   KBUILD_AFLAGS   := -D__ASSEMBLY__
> >>   KBUILD_LDFLAGS  :=
> >>
> >> +# Set this to "n" use of LTO for this build, e.g. LTO_BUILD=n
> >> +LTO_BUILD      ?= y
>
> This does not allow LTO_BUILD=y to enable LTO for CONFIG_LTO=n.
>
> We should have something like
>
> LTO_CONFIG ?= $CONFIG_LTO

The CONFIG indicates that LTO is supported, so if we want to do that,
we could fix the problems with LTO for a board/arch and send a patch
to enable it. I think we want it enabled by default.

[..]

Regards

Simon


More information about the U-Boot mailing list