summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Ivan Lozano <ivanlozano@google.com> 2025-03-06 21:28:38 +0000
committer Ivan Lozano <ivanlozano@google.com> 2025-03-06 21:49:25 +0000
commit9bdb4af19605b4694e95a38b85b35b1cda905468 (patch)
treeec16d2a6aedc3abcbf540328ac9f1ddc6837af05
parente8d5d13b78ffe0db056f1329d87130c2068b75f7 (diff)
rust: Set the rpath for rust_test modules
Set the rpath for rust_test modules to allow the runtime linker to find libraries defined in data_libs. Bug: 171710847 Test: m Change-Id: I1b67f0256826a3161a4c3193076e2ee4aef8c093
-rw-r--r--rust/test.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/rust/test.go b/rust/test.go
index 9833ffdb6..25ea463b0 100644
--- a/rust/test.go
+++ b/rust/test.go
@@ -242,6 +242,10 @@ func (test *testDecorator) compilerFlags(ctx ModuleContext, flags Flags) Flags {
flags.RustFlags = append(flags.RustFlags, "-Z panic_abort_tests")
}
+ // Add a default rpath to allow tests to dlopen libraries specified in data_libs.
+ flags.GlobalLinkFlags = append(flags.GlobalLinkFlags, `-Wl,-rpath,\$$ORIGIN/lib64`)
+ flags.GlobalLinkFlags = append(flags.GlobalLinkFlags, `-Wl,-rpath,\$$ORIGIN/lib`)
+
return flags
}