Add LTO support to soong

Enabling the lto property for a module builds that module and all static
dependencies with LTO.

LTO (link-time optimization) allows the compiler to optimize and
generate code for the entire module at link time, rather than
per-compilation unit. LTO is required for Clang CFI and other
whole-program optimization techniques. LTO also allows cross-compilation
unit optimizations that should result in faster and smaller code, at the
expense of additional compilation time.

Test: make -j12 libc with lto: true for libc

Change-Id: Ib8baefedf60e02701d44673a7c473e0845730101
This commit is contained in:
Stephen Crane
2017-05-09 15:44:35 -07:00
parent b3c2154f2a
commit ba090d16c2
4 changed files with 137 additions and 0 deletions

View File

@@ -115,6 +115,7 @@ bootstrap_go_package {
"cc/check.go",
"cc/coverage.go",
"cc/gen.go",
"cc/lto.go",
"cc/makevars.go",
"cc/prebuilt.go",
"cc/proto.go",