summaryrefslogtreecommitdiff
path: root/linker/linker.cpp
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2019-10-29 21:15:57 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2019-10-29 21:15:57 +0000
commit6f9a97f864898bb9538898b212bf0a9547b2f943 (patch)
tree3caaca853ababd196a33130510184d4ea45ca2d7 /linker/linker.cpp
parent609d6ec4162aeea66ead0e8eb2afd9b5bd4a7155 (diff)
parent09bde95f3b202b9c6001397cd51838c4f3ac0a67 (diff)
Merge "Revert "Load /dev/linker/ld.config.txt by default""
Diffstat (limited to 'linker/linker.cpp')
-rw-r--r--linker/linker.cpp30
1 files changed, 24 insertions, 6 deletions
diff --git a/linker/linker.cpp b/linker/linker.cpp
index f4fccac1e..c1bccfe12 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -93,6 +93,7 @@ static uint64_t g_module_unload_counter = 0;
static const char* const kLdConfigArchFilePath = "/system/etc/ld.config." ABI_STRING ".txt";
static const char* const kLdConfigFilePath = "/system/etc/ld.config.txt";
+static const char* const kLdConfigVndkLiteFilePath = "/system/etc/ld.config.vndk_lite.txt";
static const char* const kLdGeneratedConfigFilePath = "/dev/linkerconfig/ld.config.txt";
@@ -4052,13 +4053,30 @@ static std::string get_ld_config_file_apex_path(const char* executable_path) {
}
static std::string get_ld_config_file_vndk_path() {
- if (!file_exists(kLdGeneratedConfigFilePath)) {
- DL_WARN("Warning: failed to find generated linker configuration from \"%s\"",
- kLdGeneratedConfigFilePath);
- return "";
+ if (android::base::GetBoolProperty("ro.vndk.lite", false)) {
+ return kLdConfigVndkLiteFilePath;
}
- return kLdGeneratedConfigFilePath;
+ // Use generated linker config if flag is set
+ // TODO(b/138920271) Do not check property once it is confirmed as stable
+ // TODO(b/139638519) This file should also cover legacy or vndk-lite config
+ if (android::base::GetProperty("ro.vndk.version", "") != "" &&
+ android::base::GetBoolProperty("sys.linker.use_generated_config", true)) {
+ if (file_exists(kLdGeneratedConfigFilePath)) {
+ return kLdGeneratedConfigFilePath;
+ } else {
+ DL_WARN("Warning: failed to find generated linker configuration from \"%s\"",
+ kLdGeneratedConfigFilePath);
+ }
+ }
+
+ std::string ld_config_file_vndk = kLdConfigFilePath;
+ size_t insert_pos = ld_config_file_vndk.find_last_of('.');
+ if (insert_pos == std::string::npos) {
+ insert_pos = ld_config_file_vndk.length();
+ }
+ ld_config_file_vndk.insert(insert_pos, Config::get_vndk_version_string('.'));
+ return ld_config_file_vndk;
}
static std::string get_ld_config_file_path(const char* executable_path) {
@@ -4086,7 +4104,7 @@ static std::string get_ld_config_file_path(const char* executable_path) {
}
path = get_ld_config_file_vndk_path();
- if (!path.empty()) {
+ if (file_exists(path.c_str())) {
return path;
}