diff options
author | Peter Collingbourne <pcc@google.com> | 2019-04-30 16:05:13 -0700 |
---|---|---|
committer | Stephen Hines <srhines@google.com> | 2019-06-06 02:10:57 -0700 |
commit | d13cb58b3afda031fbe38f6dc8eaca28237c8a3b (patch) | |
tree | 2c24a26b97bdcf124828c7ab49db8db9854e2a3d /linker | |
parent | dd0d0d10a301991e53f387a0f89f7a4e27c2df07 (diff) | |
download | android_bionic-d13cb58b3afda031fbe38f6dc8eaca28237c8a3b.tar.gz android_bionic-d13cb58b3afda031fbe38f6dc8eaca28237c8a3b.tar.bz2 android_bionic-d13cb58b3afda031fbe38f6dc8eaca28237c8a3b.zip |
Add bootstrap directory to bootstrap linker's search path.
A proposed set of changes:
https://android-review.googlesource.com/q/topic:"no-dup-hwasans"
will cause the HWASAN runtime to be moved from /system/lib64 to
/system/lib64/bootstrap. This causes a problem in the case where libc is built
with HWASAN but init is not built with HWASAN. In this case, libc.so will have
a DT_NEEDED dependency on the HWASAN runtime but init will not. Currently,
init and other bootstrap executables arrange to load bootstrap libraries by
setting rpath, but rpath only has an effect on libraries directly depended
on by the main executable, not libraries indirectly depended on by it. This
means that the loading of the HWASAN runtime will fail.
Instead of relying on rpath to find the bootstrap libraries, modify the
bootstrap linker so that it searches the bootstrap library directory after
searching the rpath.
Bug: http://b/134503977
Test: Builds
Change-Id: I297be32e04ecd316ee12b8e694588e1249e2bb89
Merged-In: I297be32e04ecd316ee12b8e694588e1249e2bb89
(cherry picked from commit ea11be0cc85cb5355ca7ed4ee8736ea52b72e38d)
Diffstat (limited to 'linker')
-rw-r--r-- | linker/linker.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/linker/linker.cpp b/linker/linker.cpp index b59df7302..324f3ef23 100644 --- a/linker/linker.cpp +++ b/linker/linker.cpp @@ -1162,6 +1162,13 @@ static int open_library(android_namespace_t* ns, } } +#if !defined(__ANDROID_APEX__) + if (fd == -1) { + std::vector<std::string> bootstrap_paths = { std::string(kSystemLibDir) + "/bootstrap" }; + fd = open_library_on_paths(zip_archive_cache, name, file_offset, bootstrap_paths, realpath); + } +#endif + if (fd == -1) { fd = open_library_on_paths(zip_archive_cache, name, file_offset, ns->get_default_library_paths(), realpath); } |