[PATCH u-boot v4 14/36] build: support building with Link Time Optimizations

Simon Glass sjg at chromium.org
Thu May 20 19:51:54 CEST 2021


On Thu, 20 May 2021 at 05:25, Marek Behún <marek.behun at nic.cz> wrote:
>
> Add plumbing for building U-Boot with Link Time Optimizations.
>
> When building with LTO, $(PLATFORM_LIBS) has to be in --whole-archive /
> --no-whole-archive group, otherwise some functions declared in assembly
> may not be resolved and linking may fail.
>
> Note: clang may throw away linker list symbols it thinks are unused when
> compiling with LTO. To force these symbols to be included, we refer to
> them via the __ADDRESSABLE macro in a C file generated from compiled
> built-in.o files before linking.
>
> Signed-off-by: Marek Behún <marek.behun at nic.cz>
> ---
>  Kbuild                                |  2 +
>  Kconfig                               | 24 ++++++++++
>  Makefile                              | 67 ++++++++++++++++++++++++++-
>  scripts/Makefile.lib                  |  3 ++
>  scripts/Makefile.spl                  | 44 +++++++++++++++++-
>  scripts/gen_ll_addressable_symbols.sh | 12 +++++

That is very long. How about gen_linkerlist_syms.sh ?

>  6 files changed, 149 insertions(+), 3 deletions(-)
>  create mode 100755 scripts/gen_ll_addressable_symbols.sh

Reviewed-by: Simon Glass <sjg at chromium.org>


More information about the U-Boot mailing list