summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2018-05-10 00:41:27 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2018-05-10 00:41:27 +0000
commitcfedb7bdb35cf02bc61e204ace1c05a81cbef1dc (patch)
treed4cf1fff7a159d859e8501d46ce38a2a5cb32c4f
parent3a621d3a86058dbb315c6f111a0e86f1c6405ef7 (diff)
parentb3174d190e7e0167a9351f2153c1aa38370d8cbd (diff)
Merge "Build System: Fix rpath error if native executable under testcase folder."
-rw-r--r--cc/test.go14
1 files changed, 9 insertions, 5 deletions
diff --git a/cc/test.go b/cc/test.go
index fef636780..5d0ef20b7 100644
--- a/cc/test.go
+++ b/cc/test.go
@@ -168,13 +168,17 @@ func (test *testDecorator) linkerDeps(ctx BaseModuleContext, deps Deps) Deps {
}
func (test *testDecorator) linkerInit(ctx BaseModuleContext, linker *baseLinker) {
- // add ../../lib[64] to rpath so that out/host/linux-x86/nativetest/<test dir>/<test> can
+ // 1. Add ../../lib[64] to rpath so that out/host/linux-x86/nativetest/<test dir>/<test> can
// find out/host/linux-x86/lib[64]/library.so
- runpath := "../../lib"
- if ctx.toolchain().Is64Bit() {
- runpath += "64"
+ // 2. Add ../../../lib[64] to rpath so that out/host/linux-x86/testcases/<test dir>/<CPU>/<test> can
+ // also find out/host/linux-x86/lib[64]/library.so
+ runpaths := []string{"../../lib", "../../../lib"}
+ for _, runpath := range runpaths {
+ if ctx.toolchain().Is64Bit() {
+ runpath += "64"
+ }
+ linker.dynamicProperties.RunPaths = append(linker.dynamicProperties.RunPaths, runpath)
}
- linker.dynamicProperties.RunPaths = append(linker.dynamicProperties.RunPaths, runpath)
// add "" to rpath so that test binaries can find libraries in their own test directory
linker.dynamicProperties.RunPaths = append(linker.dynamicProperties.RunPaths, "")