From f77913f0de53fe8fb24854bc90356b3f874ea983 Mon Sep 17 00:00:00 2001 From: Pirama Arumuga Nainar Date: Mon, 25 Oct 2021 15:37:43 -0700 Subject: [rust] Switch LTO flavor to "thin" Bug: http://b/202032071 Thin LTO provides similar performance gains to full LTO but takes less time during build. Thin LTO also doesn't cause the error with `-C lto` and `-C llvm-args=--runtime-counter-relocation` in b/202032071. Test: presubmit Test: verify b/202032071 Change-Id: Id5749aaea598d4b555a9d959ed753a312ae36f26 --- rust/builder.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'rust/builder.go') diff --git a/rust/builder.go b/rust/builder.go index 426a569bf..f79cf9b12 100644 --- a/rust/builder.go +++ b/rust/builder.go @@ -95,7 +95,7 @@ func init() { func TransformSrcToBinary(ctx ModuleContext, mainSrc android.Path, deps PathDeps, flags Flags, outputFile android.WritablePath) buildOutput { - flags.GlobalRustFlags = append(flags.GlobalRustFlags, "-C lto") + flags.GlobalRustFlags = append(flags.GlobalRustFlags, "-C lto=thin") return transformSrctoCrate(ctx, mainSrc, deps, flags, outputFile, "bin") } @@ -112,13 +112,13 @@ func TransformSrctoDylib(ctx ModuleContext, mainSrc android.Path, deps PathDeps, func TransformSrctoStatic(ctx ModuleContext, mainSrc android.Path, deps PathDeps, flags Flags, outputFile android.WritablePath) buildOutput { - flags.GlobalRustFlags = append(flags.GlobalRustFlags, "-C lto") + flags.GlobalRustFlags = append(flags.GlobalRustFlags, "-C lto=thin") return transformSrctoCrate(ctx, mainSrc, deps, flags, outputFile, "staticlib") } func TransformSrctoShared(ctx ModuleContext, mainSrc android.Path, deps PathDeps, flags Flags, outputFile android.WritablePath) buildOutput { - flags.GlobalRustFlags = append(flags.GlobalRustFlags, "-C lto") + flags.GlobalRustFlags = append(flags.GlobalRustFlags, "-C lto=thin") return transformSrctoCrate(ctx, mainSrc, deps, flags, outputFile, "cdylib") } -- cgit v1.2.3-59-g8ed1b