summaryrefslogtreecommitdiff
path: root/rust/library_test.go
diff options
context:
space:
mode:
authorIvan Lozano <ivanlozano@google.com>2020-06-09 08:27:49 -0400
committerIvan Lozano <ivanlozano@google.com>2020-06-09 08:40:24 -0400
commitbec05ea26d98101b54426cc6ee55e646953f9997 (patch)
tree9c0b0a0ac825a8f06b6a4d379fa58cb4f216d9d3 /rust/library_test.go
parent3ef493ff91c343881191b1fd813f57f92f3d85eb (diff)
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
Diffstat (limited to 'rust/library_test.go')
-rw-r--r--rust/library_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/rust/library_test.go b/rust/library_test.go
index 9f9f374b9..37dd5414c 100644
--- a/rust/library_test.go
+++ b/rust/library_test.go
@@ -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"])
+ }
+}