From 9bdb4af19605b4694e95a38b85b35b1cda905468 Mon Sep 17 00:00:00 2001 From: Ivan Lozano Date: Thu, 6 Mar 2025 21:28:38 +0000 Subject: 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 --- rust/test.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'rust') 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 } -- cgit v1.2.3-59-g8ed1b