diff options
author | Kiyoung Kim <kiyoungkim@google.com> | 2020-01-29 16:31:54 +0900 |
---|---|---|
committer | Kiyoung Kim <kiyoungkim@google.com> | 2020-02-03 10:27:56 +0900 |
commit | fb58744f6b313c5f85a289555b2f5f2d732e3528 (patch) | |
tree | daccd423608802e79d221d3ce3fdd0db865f24f7 /linker/linker.cpp | |
parent | 9354f3e9a96dd0292c358d8e1afb6ef9b329be79 (diff) |
Use generated linker config for APEX binaries
LinkerConfig will start to generate linker configuration for APEX
binaries. Linker should check if this generated file exists first, and
use it if exists and otherwise use ld.config.txt under APEX etc.
Bug: 147987608
Test: m -j passed
Test: Tested with adbd and SWCodec from Cuttlefish and Crosshatch
Change-Id: I5a0c28ee1a427adface3e67c8af062e1b2ef6197
Diffstat (limited to 'linker/linker.cpp')
-rw-r--r-- | linker/linker.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/linker/linker.cpp b/linker/linker.cpp index 8de82d543..f5cf5ec16 100644 --- a/linker/linker.cpp +++ b/linker/linker.cpp @@ -3454,6 +3454,12 @@ static std::vector<android_namespace_t*> init_default_namespace_no_config(bool i 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") { + // Check auto-generated ld.config.txt first + std::string generated_apex_config = "/linkerconfig/" + paths[2] + "/ld.config.txt"; + if (file_exists(generated_apex_config.c_str())) { + return generated_apex_config; + } + return std::string("/apex/") + paths[2] + "/etc/ld.config.txt"; } return ""; |