diff options
Diffstat (limited to 'rust/compiler.go')
-rw-r--r-- | rust/compiler.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/rust/compiler.go b/rust/compiler.go index ef7fb8cfc..2600f4d0f 100644 --- a/rust/compiler.go +++ b/rust/compiler.go @@ -145,6 +145,10 @@ func (compiler *baseCompiler) coverageOutputZipPath() android.OptionalPath { panic("baseCompiler does not implement coverageOutputZipPath()") } +func (compiler *baseCompiler) static() bool { + return false +} + var _ compiler = (*baseCompiler)(nil) func (compiler *baseCompiler) inData() bool { @@ -216,7 +220,15 @@ func (compiler *baseCompiler) compilerDeps(ctx DepsContext, deps Deps) Deps { stdlib = stdlib + "_" + ctx.toolchain().RustTriple() } - deps.Rustlibs = append(deps.Rustlibs, stdlib) + // For devices, we always link stdlibs in as dylibs except for ffi static libraries. + // (rustc does not support linking libstd as a dylib for ffi static libraries) + if ctx.Host() { + deps.Rustlibs = append(deps.Rustlibs, stdlib) + } else if ctx.RustModule().compiler.static() { + deps.Rlibs = append(deps.Rlibs, stdlib) + } else { + deps.Dylibs = append(deps.Dylibs, stdlib) + } } } return deps |