Specify SONAME when building Rust shared libs.
Without specifying -soname, cc binaries are unable to locate Rust provided shared libraries. This adds the -soname linker flag for shared libraries. Bug: 158490355 Test: readelf -d <cc_binary> shows the expected SONAME Change-Id: I66852a7ce24d5ea5e426f11bc1834fb56a150628
This commit is contained in:
@@ -114,3 +114,17 @@ func TestValidateLibraryStem(t *testing.T) {
|
||||
}`)
|
||||
|
||||
}
|
||||
|
||||
func TestSharedLibraryFlags(t *testing.T) {
|
||||
ctx := testRust(t, `
|
||||
rust_library_host {
|
||||
name: "libfoo",
|
||||
srcs: ["foo.rs"],
|
||||
crate_name: "foo",
|
||||
}`)
|
||||
|
||||
libfooShared := ctx.ModuleForTests("libfoo", "linux_glibc_x86_64_shared").Output("libfoo.so")
|
||||
if !strings.Contains(libfooShared.Args["linkFlags"], "-Wl,-soname=libfoo.so") {
|
||||
t.Errorf("missing expected -Wl,-soname linker flag for libfoo shared lib, linkFlags: %#v", libfooShared.Args["linkFlags"])
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user