aboutsummaryrefslogtreecommitdiff
path: root/linker/linker_config.cpp
diff options
context:
space:
mode:
authorJustin Yun <justinyun@google.com>2017-11-27 16:28:07 +0900
committerJustin Yun <justinyun@google.com>2017-12-03 23:26:53 +0900
commit53ce74288c4ba4e303b897a4ce0b4e9806c6e87c (patch)
treec9e909d791b30da5a3106d18bb6bc18645768ae1 /linker/linker_config.cpp
parent96867b148f5cc85951bc0170c4d94f8f124f9f06 (diff)
downloadbionic-53ce74288c4ba4e303b897a4ce0b4e9806c6e87c.tar.gz
Use ld.config.$VER.txt when current VNDK version is $VER
When ro.vndk.version is set to a specific version, not "current", use ld.config.$VER.txt as a linker namespace configuration file, where $VER is the VNDK version set by ro.vndk.version. Because ro.vndk.version is set by the vendor partition, the configuration file will be automatically selected by the VNDK version of vendor patition. If ro.vndk.version is current or not set, ld.config.txt will be used as before. Bug: 69531793 Test: Build for a Pixel2 device. In the out/target/product/<device> directory, rename system/etc/ld.config.txt to system/etc/ld.config.27.1.0.txt rename system/lib[64]/vndk to system/lib[64]/vndk-27.1.0 copy system/lib[64]/vndk-sp to system/lib[64]/vndk-sp-27.1.0 set ro.vndk.version to 27.1.0 in vendor/default.prop Build system and vendor images with "make snod" and "make vnod". Disble vbmeta using avbtool. Flash a device and check boot. Change-Id: Ic55bb0a741d434e5fa93e109be15df9d9de3f105
Diffstat (limited to 'linker/linker_config.cpp')
-rw-r--r--linker/linker_config.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/linker/linker_config.cpp b/linker/linker_config.cpp
index f7d2c5367..1af5da801 100644
--- a/linker/linker_config.cpp
+++ b/linker/linker_config.cpp
@@ -33,6 +33,7 @@
#include "linker_utils.h"
#include <android-base/file.h>
+#include <android-base/properties.h>
#include <android-base/scopeguard.h>
#include <android-base/strings.h>
@@ -278,15 +279,6 @@ static bool parse_config_file(const char* ld_config_file_path,
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";
@@ -346,7 +338,7 @@ class Properties {
params.push_back({ "SDK_VER", buf });
}
- static std::string vndk = getVndkVersionString();
+ static std::string vndk = Config::get_vndk_version_string('-');
params.push_back({ "VNDK_VER", vndk });
for (auto&& path : paths) {
@@ -503,6 +495,15 @@ bool Config::read_binary_config(const char* ld_config_file_path,
return true;
}
+std::string Config::get_vndk_version_string(const char delimiter) {
+ std::string version = android::base::GetProperty("ro.vndk.version", "");
+ if (version != "" && version != "current") {
+ //add the delimiter char in front of the string and return it.
+ return version.insert(0, 1, delimiter);
+ }
+ return "";
+}
+
NamespaceConfig* Config::create_namespace_config(const std::string& name) {
namespace_configs_.push_back(std::unique_ptr<NamespaceConfig>(new NamespaceConfig(name)));
NamespaceConfig* ns_config_ptr = namespace_configs_.back().get();