rust: Mutate prebuilt modules dylib/rlib
This change makes it possible to use a single module to provide both
dylib and rlib varieties of a library. This allows the use of libstd and
libtest from a rustlibs property, allowing linkage type to change
for different variants.
Bug: 159718669
Test: cd external crates; mma; m crosvm.experimental
Change-Id: I477c4d2faec63703fdc6dd42ba020747d6a50714
diff --git a/rust/compiler.go b/rust/compiler.go
index 2aee17b..bda2cec 100644
--- a/rust/compiler.go
+++ b/rust/compiler.go
@@ -193,17 +193,7 @@
stdlib = stdlib + "_" + ctx.toolchain().RustTriple()
}
- // This check is technically insufficient - on the host, where
- // static linking is the default, if one of our static
- // dependencies uses a dynamic library, we need to dynamically
- // link the stdlib as well.
- if (len(deps.Dylibs) > 0) || ctx.Device() {
- // Dynamically linked stdlib
- deps.Dylibs = append(deps.Dylibs, stdlib)
- } else if ctx.Host() && !ctx.TargetPrimary() {
- // Otherwise use the static in-tree stdlib for host secondary arch
- deps.Rlibs = append(deps.Rlibs, stdlib+".static")
- }
+ deps.Rustlibs = append(deps.Rustlibs, stdlib)
}
}
return deps