Merge "Set search path to ro.vndk.version property"
am: 8ab16c5da6
Change-Id: I7bfc2c26e056e874c4e5549fedc4402da66a0db4
diff --git a/linker/linker_config.cpp b/linker/linker_config.cpp
index e036c05..f7d2c53 100644
--- a/linker/linker_config.cpp
+++ b/linker/linker_config.cpp
@@ -43,6 +43,9 @@
#include <string>
#include <unordered_map>
+#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
+#include <sys/_system_properties.h>
+
class ConfigParser {
public:
enum {
@@ -275,6 +278,15 @@
return true;
}
+static std::string getVndkVersionString() {
+ char vndk_version_str[1 + PROP_VALUE_MAX] = {};
+ __system_property_get("ro.vndk.version", vndk_version_str + 1);
+ if (strlen(vndk_version_str + 1) != 0 && strcmp(vndk_version_str + 1, "current") != 0) {
+ vndk_version_str[0] = '-';
+ }
+ return vndk_version_str;
+}
+
static Config g_config;
static constexpr const char* kDefaultConfigName = "default";
@@ -334,6 +346,9 @@
params.push_back({ "SDK_VER", buf });
}
+ static std::string vndk = getVndkVersionString();
+ params.push_back({ "VNDK_VER", vndk });
+
for (auto&& path : paths) {
format_string(&path, params);
}