diff options
author | neo.chae <neo.chae@lge.com> | 2016-10-04 11:00:27 +0900 |
---|---|---|
committer | Dimitry Ivanov <dimitry@google.com> | 2016-10-05 03:45:32 -0700 |
commit | 8995c3876b514bb60a363f6a484f023a4a6c2736 (patch) | |
tree | 560d9a84d063edf878d8dde88ba449467bfd1b99 /linker/linker.cpp | |
parent | ba9734ffd5697dd25fb8e534487592aafc5736ba (diff) |
Fix for default library path "/vendor/lib"
Android N restrict which libraries C/C++ code
can link against at runtime.
If device has a vendor partition
then /system/vendor symlink to /vendor.
Otherwise /vendor symlink to /system/vendor.
But is_system_library() is only checking /vendor/lib.
It will return false for /system/vendor/lib path.
It is need to add a real path to default library path.
Similarily, default ld library path is already checking.
parse_LD_LIBRARY_PATH()->parse_path()->resolve_paths()
Test: build bionic and run bionic-unit-tests
Bug: http://b/31919547
Change-Id: Ie6777e2b02729948ce77a94de32343d40358bf2c
Signed-off-by: Hyangseok Chae <neo.chae@lge.com>
(cherry picked from commit 2589f9de6473a2030594e2c5e95541f00eb2dc7a)
Diffstat (limited to 'linker/linker.cpp')
-rw-r--r-- | linker/linker.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/linker/linker.cpp b/linker/linker.cpp index 8b28d7537..9dc928eb4 100644 --- a/linker/linker.cpp +++ b/linker/linker.cpp @@ -4153,9 +4153,14 @@ static void init_default_namespace() { g_default_ld_paths = kDefaultLdPaths; } + char real_path[PATH_MAX]; std::vector<std::string> ld_default_paths; for (size_t i = 0; g_default_ld_paths[i] != nullptr; ++i) { - ld_default_paths.push_back(g_default_ld_paths[i]); + if (realpath(g_default_ld_paths[i], real_path) != nullptr) { + ld_default_paths.push_back(real_path); + } else { + ld_default_paths.push_back(g_default_ld_paths[i]); + } } g_default_namespace.set_default_library_paths(std::move(ld_default_paths)); |