Commit f59c9a62 authored by Sami Tolvanen's avatar Sami Tolvanen Committed by Amit Pundir
Browse files

ANDROID: kbuild: add support for clang LTO

This change adds the configuration option CONFIG_LTO_CLANG, and
build system support for clang's Link Time Optimization (LTO). In
preparation for LTO support for other compilers, potentially common
parts of the changes are gated behind CONFIG_LTO instead.

With -flto, instead of object files, clang produces LLVM bitcode,
which is compiled into a native object at link time, allowing the
final binary to be optimized globally. For more details, see:

  https://llvm.org/docs/LinkTimeOptimization.html



While the kernel normally uses GNU ld for linking, LLVM supports LTO
only with lld or GNU gold linkers. This patch set assumes lld will
be used.

Bug: 62093296
Bug: 67506682
Bug: 133186739
Change-Id: Ibcd9fc7ec501b4f30b43b4877897615645f8655f
Signed-off-by: default avatarSami Tolvanen <samitolvanen@google.com>

[AmitP: Fixed rebase conflicts due to upstream commits
        afa974b7 ("kbuild: add real-prereqs shorthand for $(filter-out FORCE,$^)"),
        898f5a00 ("kbuild: move archive command to scripts/Makefile.lib")]
Signed-off-by: default avatarAmit Pundir <amit.pundir@linaro.org>
parent bdeb1ae7
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment