summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cc/test.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/cc/test.go b/cc/test.go
index 3a1a3af44..a96af31bb 100644
--- a/cc/test.go
+++ b/cc/test.go
@@ -359,6 +359,12 @@ func (test *testBinary) linkerDeps(ctx DepsContext, deps Deps) Deps {
func (test *testBinary) linkerFlags(ctx ModuleContext, flags Flags) Flags {
flags = test.binaryDecorator.linkerFlags(ctx, flags)
flags = test.testDecorator.linkerFlags(ctx, flags)
+
+ // Add a default rpath to allow tests to dlopen libraries specified in data_libs.
+ // Host modules already get an rpath specified in linker.go.
+ if !ctx.Host() {
+ flags.Global.LdFlags = append(flags.Global.LdFlags, `-Wl,-rpath,\$$ORIGIN`)
+ }
return flags
}