Build Rust Device Sysroots in Soong

In order to ensure we are using current platform Bionic for any platform
Rust binaries, we need to build the sysroot in Soong. This will also
enable us too hook the "test" crate if necessary.

While both a dynamic and static sysroot are available, on device only a
dynamic sysroot will be injected. On host, we continue using the sysroot
used to build the compiler as before.

Bug: 139486496
Change-Id: I127377e5b056610ceb5015a34d266250320fbc31
This commit is contained in:
Matthew Maurer
2019-10-31 10:44:40 -07:00
parent 940ef19f77
commit 99020b04fb
6 changed files with 66 additions and 7 deletions

View File

@@ -16,7 +16,6 @@ package rust
import (
"android/soong/android"
"android/soong/rust/config"
)
func init() {
@@ -89,12 +88,6 @@ func (binary *binaryDecorator) compilerFlags(ctx ModuleContext, flags Flags) Fla
func (binary *binaryDecorator) compilerDeps(ctx DepsContext, deps Deps) Deps {
deps = binary.baseCompiler.compilerDeps(ctx, deps)
if binary.preferDynamic() || len(deps.Dylibs) > 0 {
for _, stdlib := range config.Stdlibs {
deps.Dylibs = append(deps.Dylibs, stdlib+"_"+ctx.toolchain().RustTriple())
}
}
if ctx.toolchain().Bionic() {
deps = binary.baseCompiler.bionicDeps(ctx, deps)
deps.CrtBegin = "crtbegin_dynamic"