Use ro.vndk.lite to determine the ld.config.txt
This commit adds an extra check on `ro.vndk.lite`. If `ro.vndk.lite` is
true, the linker will pick `/system/etc/ld.config.vndk_lite.txt`.
The purpose of this change is to distinguish:
1. Master-GSI + Master-VENDOR (w/o BOARD_VNDK_VERSION for upgrading devices)
2. Master-GSI + O-MR1-VENDOR (w/ BOARD_VNDK_VERSION)
Bug: 78605339
Test: aosp_sailfish Master-SYSTEM + Master-VENDOR boots
Test: aosp_sailfish Master-GSI + Master-VENDOR boots
Test: aosp_walleye Master-SYSTEM + Master-VENDOR boots
Test: aosp_walleye Master-GSI + Master-VENDOR boots
Test: aosp_walleye Master-GSI + O-MR1-VENDOR boots
Change-Id: I34f243f73c173ca2e882d3738ccb81e3fad3a9da
Merged-In: I34f243f73c173ca2e882d3738ccb81e3fad3a9da
(cherry picked from commit dd18472e56340e87a421546f2b3660d1d1ad09e2)
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 44ca7b6..0a931c6 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -44,6 +44,7 @@
#include <unordered_map>
#include <vector>
+#include <android-base/properties.h>
#include <android-base/scopeguard.h>
#include <async_safe/log.h>
@@ -85,6 +86,7 @@
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";
#if defined(__LP64__)
static const char* const kSystemLibDir = "/system/lib64";
@@ -3718,6 +3720,10 @@
}
static std::string get_ld_config_file_vndk_path() {
+ if (android::base::GetBoolProperty("ro.vndk.lite", false)) {
+ return kLdConfigVndkLiteFilePath;
+ }
+
std::string ld_config_file_vndk = kLdConfigFilePath;
size_t insert_pos = ld_config_file_vndk.find_last_of('.');
if (insert_pos == std::string::npos) {