Link device binaries dynamically by default.
Device binaries currently are linked statically by default. Instead we should be linking these dynamic by default. To avoid conflicts when manually specifying rlib dependencies on modules, we always link libstd dynamically for all device modules except static libraries. This removes the "prefer_dynamic" property entirely to avoid confusion. Bug: 165161105 Test: m profcollectd is built dynamically. Test: cd external/rust/; mma Test: cd external/crosvm/; mma Change-Id: I25ac897040acbcc2d97c791a33e8e01610632272
This commit is contained in:
@@ -177,3 +177,30 @@ func TestLints(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Test that devices are linking the stdlib dynamically
|
||||
func TestStdDeviceLinkage(t *testing.T) {
|
||||
ctx := testRust(t, `
|
||||
rust_binary {
|
||||
name: "fizz",
|
||||
srcs: ["foo.rs"],
|
||||
}
|
||||
rust_library {
|
||||
name: "libfoo",
|
||||
srcs: ["foo.rs"],
|
||||
crate_name: "foo",
|
||||
}`)
|
||||
fizz := ctx.ModuleForTests("fizz", "android_arm64_armv8-a").Module().(*Module)
|
||||
fooRlib := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_rlib").Module().(*Module)
|
||||
fooDylib := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_dylib").Module().(*Module)
|
||||
|
||||
if !android.InList("libstd", fizz.Properties.AndroidMkDylibs) {
|
||||
t.Errorf("libstd is not linked dynamically for device binaries")
|
||||
}
|
||||
if !android.InList("libstd", fooRlib.Properties.AndroidMkDylibs) {
|
||||
t.Errorf("libstd is not linked dynamically for rlibs")
|
||||
}
|
||||
if !android.InList("libstd", fooDylib.Properties.AndroidMkDylibs) {
|
||||
t.Errorf("libstd is not linked dynamically for dylibs")
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user