Use an APEX's linker configuration for any executable under its `bin` directory.
Previously, the linker configuration of an APEX would only be used for
executables located exactly in its `bin` directory. This change
relaxes this condition to also include executables located in any
directory under the APEX's `bin` directory.
This change is needed to support APEX binaries located in directories
under the APEX's `bin` directory that need to use the APEX's linker
configuration (e.g. ART gtests located in
`bin/art/{arm,arm64,x86,x86-64}` in the Testing Runtime APEX).
Test: Run ART gtests on device using the Testing Runtime APEX
Bug: 129534335
Change-Id: I0eac317eba856211a344fa00e66640aae10816ea
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 9bb6557..55d684f 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -4082,10 +4082,10 @@
return namespaces;
}
-// return /apex/<name>/etc/ld.config.txt from /apex/<name>/bin/<exec>
+// return /apex/<name>/etc/ld.config.txt from /apex/<name>/bin/*
static std::string get_ld_config_file_apex_path(const char* executable_path) {
std::vector<std::string> paths = android::base::Split(executable_path, "/");
- if (paths.size() == 5 && paths[1] == "apex" && paths[3] == "bin") {
+ if (paths.size() >= 5 && paths[1] == "apex" && paths[3] == "bin") {
return std::string("/apex/") + paths[2] + "/etc/ld.config.txt";
}
return "";