diff options
-rw-r--r-- | libnativeloader/Android.bp | 4 | ||||
-rw-r--r-- | libnativeloader/public_libraries.cpp | 28 | ||||
-rwxr-xr-x | tools/buildbot-build.sh | 2 | ||||
-rwxr-xr-x | tools/buildbot-sync.sh | 45 |
4 files changed, 16 insertions, 63 deletions
diff --git a/libnativeloader/Android.bp b/libnativeloader/Android.bp index f6dab2d723..a732276dee 100644 --- a/libnativeloader/Android.bp +++ b/libnativeloader/Android.bp @@ -47,10 +47,6 @@ cc_library { ], }, }, - required: [ - "llndk.libraries.txt", - "vndksp.libraries.txt", - ], stubs: { symbol_file: "libnativeloader.map.txt", versions: ["1"], diff --git a/libnativeloader/public_libraries.cpp b/libnativeloader/public_libraries.cpp index 8ab8368694..157ace5ad5 100644 --- a/libnativeloader/public_libraries.cpp +++ b/libnativeloader/public_libraries.cpp @@ -50,8 +50,8 @@ constexpr const char* kDefaultPublicLibrariesFile = "/etc/public.libraries.txt"; constexpr const char* kExtendedPublicLibrariesFilePrefix = "public.libraries-"; constexpr const char* kExtendedPublicLibrariesFileSuffix = ".txt"; constexpr const char* kVendorPublicLibrariesFile = "/vendor/etc/public.libraries.txt"; -constexpr const char* kLlndkLibrariesFile = "/system/etc/llndk.libraries.txt"; -constexpr const char* kVndkLibrariesFile = "/system/etc/vndksp.libraries.txt"; +constexpr const char* kLlndkLibrariesFile = "/apex/com.android.vndk.v{}/etc/llndk.libraries.{}.txt"; +constexpr const char* kVndkLibrariesFile = "/apex/com.android.vndk.v{}/etc/vndksp.libraries.{}.txt"; const std::vector<const std::string> kArtApexPublicLibraries = { "libicuuc.so", @@ -76,11 +76,13 @@ bool debuggable() { } std::string vndk_version_str(bool use_product_vndk) { - static std::string version = get_vndk_version(use_product_vndk); - if (version != "" && version != "current") { - return "." + version; + if (use_product_vndk) { + static std::string product_vndk_version = get_vndk_version(true); + return product_vndk_version; + } else { + static std::string vendor_vndk_version = get_vndk_version(false); + return vendor_vndk_version; } - return ""; } // For debuggable platform builds use ANDROID_ADDITIONAL_PUBLIC_LIBRARIES environment @@ -93,13 +95,15 @@ std::string additional_public_libraries() { return ""; } +// insert vndk version in every {} placeholder void InsertVndkVersionStr(std::string* file_name, bool use_product_vndk) { CHECK(file_name != nullptr); - size_t insert_pos = file_name->find_last_of("."); - if (insert_pos == std::string::npos) { - insert_pos = file_name->length(); + auto version = vndk_version_str(use_product_vndk); + size_t pos = file_name->find("{}"); + while (pos != std::string::npos) { + file_name->replace(pos, 2, version); + pos = file_name->find("{}", pos + version.size()); } - file_name->insert(insert_pos, vndk_version_str(use_product_vndk)); } const std::function<Result<bool>(const struct ConfigEntry&)> always_true = @@ -256,7 +260,7 @@ static std::string InitLlndkLibrariesVendor() { InsertVndkVersionStr(&config_file, false); auto sonames = ReadConfig(config_file, always_true); if (!sonames.ok()) { - LOG_ALWAYS_FATAL("%s", sonames.error().message().c_str()); + LOG_ALWAYS_FATAL("%s: %s", config_file.c_str(), sonames.error().message().c_str()); return ""; } return android::base::Join(*sonames, ':'); @@ -267,7 +271,7 @@ static std::string InitLlndkLibrariesProduct() { InsertVndkVersionStr(&config_file, true); auto sonames = ReadConfig(config_file, always_true); if (!sonames.ok()) { - LOG_ALWAYS_FATAL("%s", sonames.error().message().c_str()); + LOG_ALWAYS_FATAL("%s: %s", config_file.c_str(), sonames.error().message().c_str()); return ""; } return android::base::Join(*sonames, ':'); diff --git a/tools/buildbot-build.sh b/tools/buildbot-build.sh index 71180a2fde..17c68f6b61 100755 --- a/tools/buildbot-build.sh +++ b/tools/buildbot-build.sh @@ -83,8 +83,6 @@ elif [[ $mode == "target" ]]; then # Targets required to generate a linker configuration on device within the # chroot environment. make_command+=" linkerconfig" - make_command+=" llndk.libraries.txt vndksp.libraries.txt vndkcore.libraries.txt" - make_command+=" vndkprivate.libraries.txt vndkcorevariant.libraries.txt sanitizer.libraries.txt" # Additional targets needed for the chroot environment. make_command+=" crash_dump event-log-tags" fi diff --git a/tools/buildbot-sync.sh b/tools/buildbot-sync.sh index 4b5ee8692f..de83c502cd 100755 --- a/tools/buildbot-sync.sh +++ b/tools/buildbot-sync.sh @@ -110,51 +110,6 @@ ld_generated_config_file_path="/linkerconfig/ld.config.txt" # Location of the generated linker configuration file. ld_generated_config_file_location=$(dirname "$ld_generated_config_file_path") -# Return the file name passed as argument with the VNDK version of the "host -# system" inserted before the file name's extension, if applicable. This mimics -# the logic used in Bionic linker's `Config::get_vndk_version_string`. -insert_vndk_version_string() { - local file_path="$1" - local vndk_version=$(adb shell getprop "ro.vndk.version") - if [[ -n "$vndk_version" ]] && [[ "$vndk_version" != current ]]; then - # Insert the VNDK version after the last period (and add another period). - file_path=$(echo "$file_path" \ - | sed -e "s/^\\(.*\\)\\.\\([^.]\\)/\\1.${vndk_version}.\\2/") - fi - echo "$file_path" -} - -# Adjust the names of the following files (sync'd to the device with the -# previous `adb push` command) depending on the VNDK version of the "host -# system": -# -# /system/etc/llndk.libraries.R.txt -# /system/etc/vndkcore.libraries.R.txt -# /system/etc/vndkprivate.libraries.R.txt -# /system/etc/vndksp.libraries.R.txt -# -# Note that `/system/etc/vndkcorevariant.libraries.txt` does not have a version -# number. -# -# See `build/soong/cc/vndk.go` and `packages/modules/vndk/Android.bp` for more -# information. -vndk_libraries_txt_file_names="llndk.libraries.txt \ - vndkcore.libraries.txt \ - vndkprivate.libraries.txt \ - vndksp.libraries.txt" -for file_name in $vndk_libraries_txt_file_names; do - pattern="$(basename $file_name .txt)\*.txt" - adb shell find "$ART_TEST_CHROOT/system/etc" -maxdepth 1 -name "$pattern" | \ - while read src_file_name; do - dst_file_name="$ART_TEST_CHROOT/system/etc/$(insert_vndk_version_string "$file_name")" - if [[ "$src_file_name" != "$dst_file_name" ]]; then - echo -e "${green}Renaming VNDK libraries file in chroot environment:" \ - "\`$src_file_name\` -> \`$dst_file_name\`${nc}" - adb shell mv -f "$src_file_name" "$dst_file_name" - fi - done -done - # Generate linker configuration files on device. echo -e "${green}Generating linker configuration files on device in" \ "\`$ld_generated_config_file_path\`${nc}..." |