Enable LTO for Rust dylibs

Test: m rust
Test: TH
Change-Id: I2257fe9fce1457821a5cf7df644c73f3137a62bb
This commit is contained in:
Chris Wailes 2023-03-02 16:06:01 -08:00
parent aa3408a506
commit 5f78840308
2 changed files with 3 additions and 0 deletions

View file

@ -134,6 +134,8 @@ func TransformSrctoRlib(ctx ModuleContext, mainSrc android.Path, deps PathDeps,
func TransformSrctoDylib(ctx ModuleContext, mainSrc android.Path, deps PathDeps, flags Flags,
outputFile android.WritablePath) buildOutput {
flags.GlobalRustFlags = append(flags.GlobalRustFlags, "-C lto=thin")
return transformSrctoCrate(ctx, mainSrc, deps, flags, outputFile, "dylib")
}

View file

@ -54,6 +54,7 @@ var (
// TODO (b/267698452): Temporary workaround until the "no unstable
// features" policy is enforced.
"-A stable-features",
"-Zdylib-lto",
}
deviceGlobalRustFlags = []string{