Merge "Add rust default compilation flags."

This commit is contained in:
Ivan Lozano 2019-11-21 17:45:45 +00:00 committed by Gerrit Code Review
commit 0aa51a018b
2 changed files with 7 additions and 0 deletions

View file

@ -44,6 +44,8 @@ func init() {
func TransformSrcToBinary(ctx android.ModuleContext, mainSrc android.Path, deps PathDeps, flags Flags,
outputFile android.WritablePath, includeDirs []string) {
flags.RustFlags = append(flags.RustFlags, "-C lto")
transformSrctoCrate(ctx, mainSrc, deps, flags, outputFile, "bin", includeDirs)
}
@ -59,11 +61,13 @@ func TransformSrctoDylib(ctx android.ModuleContext, mainSrc android.Path, deps P
func TransformSrctoStatic(ctx android.ModuleContext, mainSrc android.Path, deps PathDeps, flags Flags,
outputFile android.WritablePath, includeDirs []string) {
flags.RustFlags = append(flags.RustFlags, "-C lto")
transformSrctoCrate(ctx, mainSrc, deps, flags, outputFile, "staticlib", includeDirs)
}
func TransformSrctoShared(ctx android.ModuleContext, mainSrc android.Path, deps PathDeps, flags Flags,
outputFile android.WritablePath, includeDirs []string) {
flags.RustFlags = append(flags.RustFlags, "-C lto")
transformSrctoCrate(ctx, mainSrc, deps, flags, outputFile, "cdylib", includeDirs)
}

View file

@ -37,6 +37,9 @@ var (
GlobalRustFlags = []string{
"--remap-path-prefix $$(pwd)=",
"-C codegen-units=1",
"-C opt-level=3",
"-C relocation-model=pic",
}
deviceGlobalRustFlags = []string{}