Allow native_bridge linker to use different APEX from native one
Bug: http://b/156397945
Test: dlfcn.dlopen_system_libicuuc_android_api_level_28 with native_bridge
Change-Id: I3ecd929a0c31dda8cd424795f21f6ef472776557
diff --git a/linker/linker.cpp b/linker/linker.cpp
index b368e96..edf0329 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -65,6 +65,7 @@
#include "linker_phdr.h"
#include "linker_relocate.h"
#include "linker_tls.h"
+#include "linker_translate_path.h"
#include "linker_utils.h"
#include "private/bionic_call_ifunc_resolver.h"
@@ -103,7 +104,6 @@
static const char* const kAsanSystemLibDir = "/data/asan/system/lib64";
static const char* const kAsanOdmLibDir = "/data/asan/odm/lib64";
static const char* const kAsanVendorLibDir = "/data/asan/vendor/lib64";
-static const char* const kI18nApexLibDir = "/apex/com.android.i18n/lib64";
#else
static const char* const kSystemLibDir = "/system/lib";
static const char* const kOdmLibDir = "/odm/lib";
@@ -111,7 +111,6 @@
static const char* const kAsanSystemLibDir = "/data/asan/system/lib";
static const char* const kAsanOdmLibDir = "/data/asan/odm/lib";
static const char* const kAsanVendorLibDir = "/data/asan/vendor/lib";
-static const char* const kI18nApexLibDir = "/apex/com.android.i18n/lib";
#endif
static const char* const kAsanLibDirPrefix = "/data/asan";
@@ -235,44 +234,6 @@
}
// END OF WORKAROUND
-// Workaround for dlopen(/system/lib(64)/<soname>) when .so is in /apex. http://b/121248172
-/**
- * Translate /system path to /apex path if needed
- * The workaround should work only when targetSdkVersion < Q.
- *
- * param out_name_to_apex pointing to /apex path
- * return true if translation is needed
- */
-static bool translateSystemPathToApexPath(const char* name, std::string* out_name_to_apex) {
- static const char* const kSystemToArtApexLibs[] = {
- "libicuuc.so",
- "libicui18n.so",
- };
- // New mapping for new apex should be added below
-
- // Nothing to do if target sdk version is Q or above
- if (get_application_target_sdk_version() >= 29) {
- return false;
- }
-
- // If the path isn't /system/lib, there's nothing to do.
- if (name == nullptr || dirname(name) != kSystemLibDir) {
- return false;
- }
-
- const char* base_name = basename(name);
-
- for (const char* soname : kSystemToArtApexLibs) {
- if (strcmp(base_name, soname) == 0) {
- *out_name_to_apex = std::string(kI18nApexLibDir) + "/" + base_name;
- return true;
- }
- }
-
- return false;
-}
-// End Workaround for dlopen(/system/lib/<soname>) when .so is in /apex.
-
static std::vector<std::string> g_ld_preload_names;
static void notify_gdb_of_load(soinfo* info) {