diff options
author | 2025-01-29 15:18:17 -0800 | |
---|---|---|
committer | 2025-01-30 10:21:40 -0800 | |
commit | ce48f5f396e37516e8f29680f4b5c7071375f2fc (patch) | |
tree | afe40a60b3e85af81d6ddcd06ebe043093803fb3 /rust/compiler.go | |
parent | 54825428e454f6e1219dcbbbb8f4b09d76410026 (diff) |
Do not perform LTO for Rust binaries during eng builds
Test: TH
Bug: 289094772
Change-Id: I4221a398a2afd3c83298ee9935634b7a6189f487
Diffstat (limited to 'rust/compiler.go')
-rw-r--r-- | rust/compiler.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/rust/compiler.go b/rust/compiler.go index 1d2fb58c3..8ea5769a0 100644 --- a/rust/compiler.go +++ b/rust/compiler.go @@ -450,6 +450,11 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flag } } + // Enable LTO for non-engineering builds if the module supports and requests it. + if !ctx.Config().Eng() && !(ctx.RustModule().Rlib() || ctx.RustModule().ProcMacro()) && ctx.RustModule().compiler.Thinlto() { + flags.GlobalRustFlags = append(flags.GlobalRustFlags, "-C lto=thin") + } + flags.RustFlags = append(flags.RustFlags, lintFlags) flags.RustFlags = append(flags.RustFlags, compiler.Properties.Flags...) flags.RustFlags = append(flags.RustFlags, "--edition="+compiler.edition()) |