diff options
author | Simon Glass <sjg@chromium.org> | 2022-08-03 12:13:08 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-09-02 16:20:11 -0400 |
commit | a55014d09b29d7bc2cbaeb8e41a155c9a257a183 (patch) | |
tree | 7651a422b0d01a6a8ed0375e8f1a6eff3065df3f /doc | |
parent | 583f1b2f10be36f86a2da3686d406bfd90cfbc70 (diff) | |
download | u-boot-a55014d09b29d7bc2cbaeb8e41a155c9a257a183.tar.gz u-boot-a55014d09b29d7bc2cbaeb8e41a155c9a257a183.tar.bz2 u-boot-a55014d09b29d7bc2cbaeb8e41a155c9a257a183.zip |
Makefile: Allow LTO to be disabled for a build
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 NO_LTO parameter to the build, similar to NO_SDL, 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@chromium.org>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/build/gcc.rst | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/doc/build/gcc.rst b/doc/build/gcc.rst index ee544ad87e..a71f860a48 100644 --- a/doc/build/gcc.rst +++ b/doc/build/gcc.rst @@ -152,6 +152,23 @@ of dtc is new enough. It also makes sure that pylibfdt is present, if needed Note that the :doc:`tools` are always built with the included version of libfdt so it is not possible to build U-Boot tools with a system libfdt, at present. +Link-time optimisation (LTO) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +U-Boot supports link-time optimisation which can reduce the size of the final +U-Boot binaries, particularly with SPL. + +At present this can be enabled by ARM boards by adding `CONFIG_LTO=y` into the +defconfig file. Other architectures are not supported. LTO is enabled by default +for sandbox. + +This does incur a link-time penalty of several seconds. For faster incremental +builds during development, you can disable it by setting `NO_LTO` to `1`. + +.. code-block:: bash + + NO_LTO=1 make + Other build targets ~~~~~~~~~~~~~~~~~~~ |