[rust] Pass cc dependencies as linker flags.
In order to support cc dependencies which do not start with the 'lib' prefix, we can't pass them through the -l flag. Instead, we can pass them directly to linker flags. Bug: 166151658 Test: cd external/rust/; mma Test: cd external/crosvm/; mma Test: Test linking to a cc dep that does not begin with 'lib' Change-Id: I5acbf3d3405e66446f3eae600b35683c4eb3d8a5
This commit is contained in:
@@ -58,3 +58,21 @@ func TestPreferDynamicBinary(t *testing.T) {
|
||||
t.Errorf("unexpected prefer-dynamic flag, rustcFlags: %#v", flags)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLinkObjects(t *testing.T) {
|
||||
ctx := testRust(t, `
|
||||
rust_binary {
|
||||
name: "fizz-buzz",
|
||||
srcs: ["foo.rs"],
|
||||
shared_libs: ["libfoo"],
|
||||
}
|
||||
cc_library {
|
||||
name: "libfoo",
|
||||
}`)
|
||||
|
||||
fizzBuzz := ctx.ModuleForTests("fizz-buzz", "android_arm64_armv8-a").Output("fizz-buzz")
|
||||
linkFlags := fizzBuzz.Args["linkFlags"]
|
||||
if !strings.Contains(linkFlags, "/libfoo.so") {
|
||||
t.Errorf("missing shared dependency 'libfoo.so' in linkFlags: %#v", linkFlags)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user