For some reason, using the crazy linker does not work with the component build. It was thus disabled in such builds in a previous bug: This entry is to understand the issue and be able to run component builds with it reliably.
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/bfd4a54d8f6c2e0f617ea27ea60e2b01e3164a27 commit bfd4a54d8f6c2e0f617ea27ea60e2b01e3164a27 Author: David 'Digit' Turner <digit@google.com> Date: Thu May 03 15:22:52 2018 android: crazy_linker: Add a few move constructors. Now that we can safely depend on C++11, add a few move constructors to the String and Vector utility classes. This will be used in future CLs used to fix various issues with the crazy linker. BUG=802068 R=pasko@chromium.org, lizeb@chromium.org, agrieve@chromium.org Change-Id: I7fe420fe16e03e2eb1dbabafdcc0fb72c40ce3ba Reviewed-on: https://chromium-review.googlesource.com/1041960 Commit-Queue: David Turner <digit@chromium.org> Reviewed-by: Egor Pasko <pasko@chromium.org> Cr-Commit-Position: refs/heads/master@{#555738} [modify] https://crrev.com/bfd4a54d8f6c2e0f617ea27ea60e2b01e3164a27/third_party/android_crazy_linker/src/src/crazy_linker_util.cpp [modify] https://crrev.com/bfd4a54d8f6c2e0f617ea27ea60e2b01e3164a27/third_party/android_crazy_linker/src/src/crazy_linker_util.h [modify] https://crrev.com/bfd4a54d8f6c2e0f617ea27ea60e2b01e3164a27/third_party/android_crazy_linker/src/src/crazy_linker_util_unittest.cpp
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/fae782539770f292b3961d17c6fd17a9fcd1e890 commit fae782539770f292b3961d17c6fd17a9fcd1e890 Author: David 'Digit' Turner <digit@google.com> Date: Thu May 03 18:25:31 2018 android: crazy_linker: Remove obsolete API. Remove an obsolete API that allows a crazy linker client to set a library load offset. This was intended for loading libraries directly from zip files, but was never used as is. Besides, a future CL will refactor how libraries are located and loaded from zip files in a completely different way (i.e. adding the zip file path to the library search path). BUG=802068 R=pasko@chromium.org, lizeb@chromium.org, agrieve@chromium.org Change-Id: I33e2c1fe50a5a1accb42494f3a29a4d1128d5ea3 Reviewed-on: https://chromium-review.googlesource.com/1041963 Reviewed-by: David Turner <digit@chromium.org> Reviewed-by: Benoit L <lizeb@chromium.org> Commit-Queue: David Turner <digit@chromium.org> Cr-Commit-Position: refs/heads/master@{#555818} [modify] https://crrev.com/fae782539770f292b3961d17c6fd17a9fcd1e890/third_party/android_crazy_linker/src/include/crazy_linker.h [modify] https://crrev.com/fae782539770f292b3961d17c6fd17a9fcd1e890/third_party/android_crazy_linker/src/src/crazy_linker_api.cpp
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/a1b71cc69d7b36a9d87980a091d2d79ee4b966ea commit a1b71cc69d7b36a9d87980a091d2d79ee4b966ea Author: David 'Digit' Turner <digit@google.com> Date: Thu May 03 19:38:37 2018 android: crazy_linker: Update zip test data tables. This CL moves the data tables used to test the zip parsing code into its own source file. Also modify generate_zip_test_tables.sh to also generate data for a zip archive that contains two mock uncompressed shared libraries. These will be used in a future CL that changes the way the crazy linker loads files from zip archives. BUG=802068 R=agrieve@chromium.org, lizeb@chromium.org, pasko@chromium.org Change-Id: Ifb440eb3c050227bb3e9354f4ead859824362c76 Reviewed-on: https://chromium-review.googlesource.com/1042245 Commit-Queue: David Turner <digit@chromium.org> Reviewed-by: Egor Pasko <pasko@chromium.org> Cr-Commit-Position: refs/heads/master@{#555847} [modify] https://crrev.com/a1b71cc69d7b36a9d87980a091d2d79ee4b966ea/third_party/android_crazy_linker/BUILD.gn [add] https://crrev.com/a1b71cc69d7b36a9d87980a091d2d79ee4b966ea/third_party/android_crazy_linker/src/src/crazy_linker_zip_test_data.cpp [add] https://crrev.com/a1b71cc69d7b36a9d87980a091d2d79ee4b966ea/third_party/android_crazy_linker/src/src/crazy_linker_zip_test_data.h [modify] https://crrev.com/a1b71cc69d7b36a9d87980a091d2d79ee4b966ea/third_party/android_crazy_linker/src/src/crazy_linker_zip_unittest.cpp [modify] https://crrev.com/a1b71cc69d7b36a9d87980a091d2d79ee4b966ea/third_party/android_crazy_linker/src/tests/generate_zip_test_tables.sh
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/76551bcdd9756cce023b15502c71174d7d2d15f5 commit 76551bcdd9756cce023b15502c71174d7d2d15f5 Author: David 'Digit' Turner <digit@google.com> Date: Wed May 09 09:58:41 2018 android: crazy_linker: Allow searching libraries inside zip archives. This modifies the internal crazy::SearchPathList class to support looking up libraries inside zip archives, in two ways: - First, by supporting paths with an exclamation mark, used as a delimiter between zip archive paths, and file sub-paths within it. For example, looking for: /path/to/archive.zip!libs/libfoo.so Will search the zip archive at /path/to/archive.zip for a file named libs/libfoo.so. Note that path items added through AddPaths() can also contain an exclamation mark. - Second, automatically support zip files stored with a 'crazy.' prefix (e.g. /path/to/archive.zip!libs/libfoo.so will match a file named 'libs/crazy.libfoo.so' in the archive too. This is useful to store uncompressed libraries inside Android APKs while preventing the system from extracting them when the application is installed or updated. Note that this does not modify the rest of the crazy linker to use this for now (e.g. to implement LoadLibraryFromZipFile()), since this will require more work (to be provided in a future CL). BUG=802068 R=agrieve@chromium.org,pasko@chromium.org,lizeb@chromium.org Change-Id: Ic8661332e4e4537a472e325b74c8c001ea2bc113 Reviewed-on: https://chromium-review.googlesource.com/1042394 Commit-Queue: David Turner <digit@chromium.org> Reviewed-by: agrieve <agrieve@chromium.org> Cr-Commit-Position: refs/heads/master@{#557131} [modify] https://crrev.com/76551bcdd9756cce023b15502c71174d7d2d15f5/third_party/android_crazy_linker/src/src/crazy_linker_library_list.cpp [modify] https://crrev.com/76551bcdd9756cce023b15502c71174d7d2d15f5/third_party/android_crazy_linker/src/src/crazy_linker_search_path_list.cpp [modify] https://crrev.com/76551bcdd9756cce023b15502c71174d7d2d15f5/third_party/android_crazy_linker/src/src/crazy_linker_search_path_list.h [modify] https://crrev.com/76551bcdd9756cce023b15502c71174d7d2d15f5/third_party/android_crazy_linker/src/src/crazy_linker_search_path_list_unittest.cpp [modify] https://crrev.com/76551bcdd9756cce023b15502c71174d7d2d15f5/third_party/android_crazy_linker/src/src/crazy_linker_system.cpp [modify] https://crrev.com/76551bcdd9756cce023b15502c71174d7d2d15f5/third_party/android_crazy_linker/src/src/crazy_linker_system.h [modify] https://crrev.com/76551bcdd9756cce023b15502c71174d7d2d15f5/third_party/android_crazy_linker/src/src/crazy_linker_system_unittest.cpp
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/545e932504896f864439b1c7e5a29edd2f9e4a2a commit 545e932504896f864439b1c7e5a29edd2f9e4a2a Author: David 'Digit' Turner <digit@google.com> Date: Wed May 09 14:34:52 2018 android: crazy_linker: Read library DT_SONAME entry. This CL slightly modifies the crazy linker to extract the DT_SONAME of a given shared library. The goal is to use the soname as the unique identifier for a library during dependency resolution, as this matches the behaviour of the system linker. More precisely: - Before this CL, each library loaded by the linker is identified by a "name" that was the library path (with any directory sub-path) used to load the library. This prevents properly resolving DT_NEEDED entries, which explains one of the reasons why the crazy linker doesn't support the component build at the moment. - After this CL, system libraries are identified by their basename only (which was already the case when they were loaded through DT_NEEDED entries, but changes what happens when they are loaded through the dlopen() wrapper). Ideally, non-system libraries should be identified by the soname, but this currently doesn't work, because it breaks RELRO sharing. The reason for this is that, when loading libraries directly from a zip file, the current client code (chromium_android_linker) passes and relies on the path to the host APK directly (e.g. something like /data/data/<package-name>-<number>/base.apk and a file offset. This will be addressed in a future CL. BUG=802068 R=lizeb@chromium.org, pasko@chromium.org, agrieve@chromium.org Change-Id: Ia282c29e80e8729c4079a80de7acf66975b7d1ee Reviewed-on: https://chromium-review.googlesource.com/1042406 Commit-Queue: David Turner <digit@chromium.org> Reviewed-by: agrieve <agrieve@chromium.org> Cr-Commit-Position: refs/heads/master@{#557175} [modify] https://crrev.com/545e932504896f864439b1c7e5a29edd2f9e4a2a/third_party/android_crazy_linker/src/src/crazy_linker_library_list.cpp [modify] https://crrev.com/545e932504896f864439b1c7e5a29edd2f9e4a2a/third_party/android_crazy_linker/src/src/crazy_linker_library_view.cpp [modify] https://crrev.com/545e932504896f864439b1c7e5a29edd2f9e4a2a/third_party/android_crazy_linker/src/src/crazy_linker_library_view.h [modify] https://crrev.com/545e932504896f864439b1c7e5a29edd2f9e4a2a/third_party/android_crazy_linker/src/src/crazy_linker_shared_library.cpp [modify] https://crrev.com/545e932504896f864439b1c7e5a29edd2f9e4a2a/third_party/android_crazy_linker/src/src/crazy_linker_shared_library.h [modify] https://crrev.com/545e932504896f864439b1c7e5a29edd2f9e4a2a/third_party/android_crazy_linker/src/src/crazy_linker_wrappers.cpp
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/ad16aee9590a3ba86af8c8a26acf24de4c230ac2 commit ad16aee9590a3ba86af8c8a26acf24de4c230ac2 Author: David 'Digit' Turner <digit@google.com> Date: Thu Jun 07 21:08:13 2018 android: crazy-linker: Simplify zip library loading. Use SearchPathList::Find()'s ability to look directly inside a zip archive if the path contains a ! separator to simplify LibraryList::LoadLibraryFromZipFile(). + LibraryList::LoadLibraryWithSystemLinker() is introduced to greatly simplify the code flow and the LibraryList::LoadLibrary() parameter list. This is part of an ongoing effort to support the component build, cleanup the crazy linker, and better detect system libraries. NOTE: The LegacyLinker.java change is necessary to ensure RELRO sharing works properly. The issue was that the RELRO was associated with the file path of the APK itself, instead of the library SO_NAME. BUG=802068,843987 R=pasko@chromium.org, agrieve@chromium.org, rcmilroy@chromium.org Change-Id: I833b02635f71d0bf63794681ba78e9a33647e204 Reviewed-on: https://chromium-review.googlesource.com/1091058 Reviewed-by: agrieve <agrieve@chromium.org> Commit-Queue: David Turner <digit@chromium.org> Cr-Commit-Position: refs/heads/master@{#565407} [modify] https://crrev.com/ad16aee9590a3ba86af8c8a26acf24de4c230ac2/base/android/java/src/org/chromium/base/library_loader/LegacyLinker.java [modify] https://crrev.com/ad16aee9590a3ba86af8c8a26acf24de4c230ac2/third_party/android_crazy_linker/src/src/crazy_linker_api.cpp [modify] https://crrev.com/ad16aee9590a3ba86af8c8a26acf24de4c230ac2/third_party/android_crazy_linker/src/src/crazy_linker_library_list.cpp [modify] https://crrev.com/ad16aee9590a3ba86af8c8a26acf24de4c230ac2/third_party/android_crazy_linker/src/src/crazy_linker_library_list.h [modify] https://crrev.com/ad16aee9590a3ba86af8c8a26acf24de4c230ac2/third_party/android_crazy_linker/src/src/crazy_linker_library_view.h [modify] https://crrev.com/ad16aee9590a3ba86af8c8a26acf24de4c230ac2/third_party/android_crazy_linker/src/src/crazy_linker_wrappers.cpp
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/2d9ea2afcd2a6911c7f54a945d9b41cb217ea33e commit 2d9ea2afcd2a6911c7f54a945d9b41cb217ea33e Author: David 'Digit' Turner <digit@google.com> Date: Mon Jun 11 17:08:41 2018 chromium_android_linker: Simplify loading from zip archives. Now that the crazy linker supports finding and loading libraries directly from zip archives, by adding a search path item that contains an exclamation mark, use that feature to simplify the chromium android linker Java and C++ sources. This allow us to remove the ugly function crazy_linker_load_library_from_zip_file() and the code it depends on from the crazy linker as well. BUG=802068,843987 R=agrieve@chromium.org, rmcilroy@chromium.org, pasko@chromium.org Change-Id: I15a5493c1bd7e9b5bbc40185e947db42fe5779b9 Reviewed-on: https://chromium-review.googlesource.com/1094641 Reviewed-by: agrieve <agrieve@chromium.org> Commit-Queue: David Turner <digit@chromium.org> Cr-Commit-Position: refs/heads/master@{#566036} [modify] https://crrev.com/2d9ea2afcd2a6911c7f54a945d9b41cb217ea33e/base/android/java/src/org/chromium/base/library_loader/LegacyLinker.java [modify] https://crrev.com/2d9ea2afcd2a6911c7f54a945d9b41cb217ea33e/base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java [modify] https://crrev.com/2d9ea2afcd2a6911c7f54a945d9b41cb217ea33e/base/android/java/src/org/chromium/base/library_loader/Linker.java [modify] https://crrev.com/2d9ea2afcd2a6911c7f54a945d9b41cb217ea33e/base/android/linker/legacy_linker_jni.cc [modify] https://crrev.com/2d9ea2afcd2a6911c7f54a945d9b41cb217ea33e/third_party/android_crazy_linker/src/include/crazy_linker.h [modify] https://crrev.com/2d9ea2afcd2a6911c7f54a945d9b41cb217ea33e/third_party/android_crazy_linker/src/src/crazy_linker_api.cpp [modify] https://crrev.com/2d9ea2afcd2a6911c7f54a945d9b41cb217ea33e/third_party/android_crazy_linker/src/src/crazy_linker_library_list.cpp [modify] https://crrev.com/2d9ea2afcd2a6911c7f54a945d9b41cb217ea33e/third_party/android_crazy_linker/src/src/crazy_linker_library_list.h
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/901d58a2649bd8977365b4af8c6159bbd5d5e70b commit 901d58a2649bd8977365b4af8c6159bbd5d5e70b Author: David 'Digit' Turner <digit@google.com> Date: Fri Aug 10 08:00:56 2018 android: crazy_linker: Minor cleanups. Minor cleanups to the code base. Preparing for future changes. BUG=843987,802068 R=agrieve@chromium.org, pasko@chromium.org, rmcilroy@chromium.org Change-Id: I65598259521b3e21b540cedadba99cfa58f13051 Reviewed-on: https://chromium-review.googlesource.com/1169480 Reviewed-by: agrieve <agrieve@chromium.org> Reviewed-by: Ross McIlroy <rmcilroy@chromium.org> Reviewed-by: Egor Pasko <pasko@chromium.org> Commit-Queue: David Turner <digit@chromium.org> Cr-Commit-Position: refs/heads/master@{#582088} [modify] https://crrev.com/901d58a2649bd8977365b4af8c6159bbd5d5e70b/third_party/android_crazy_linker/BUILD.gn [modify] https://crrev.com/901d58a2649bd8977365b4af8c6159bbd5d5e70b/third_party/android_crazy_linker/src/src/crazy_linker_pointer_set.cpp [modify] https://crrev.com/901d58a2649bd8977365b4af8c6159bbd5d5e70b/third_party/android_crazy_linker/src/src/crazy_linker_pointer_set.h [modify] https://crrev.com/901d58a2649bd8977365b4af8c6159bbd5d5e70b/third_party/android_crazy_linker/src/src/crazy_linker_pointer_set_unittest.cpp [modify] https://crrev.com/901d58a2649bd8977365b4af8c6159bbd5d5e70b/third_party/android_crazy_linker/src/src/crazy_linker_system.cpp [modify] https://crrev.com/901d58a2649bd8977365b4af8c6159bbd5d5e70b/third_party/android_crazy_linker/src/src/crazy_linker_system_mock.cpp [modify] https://crrev.com/901d58a2649bd8977365b4af8c6159bbd5d5e70b/third_party/android_crazy_linker/src/src/crazy_linker_util.cpp [modify] https://crrev.com/901d58a2649bd8977365b4af8c6159bbd5d5e70b/third_party/android_crazy_linker/src/src/crazy_linker_util.h [modify] https://crrev.com/901d58a2649bd8977365b4af8c6159bbd5d5e70b/third_party/android_crazy_linker/src/src/crazy_linker_util_unittest.cpp [modify] https://crrev.com/901d58a2649bd8977365b4af8c6159bbd5d5e70b/third_party/android_crazy_linker/src/src/crazy_linker_wrappers.cpp
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/a6a2898fbc25e7b76550954eea99df00a3fda590 commit a6a2898fbc25e7b76550954eea99df00a3fda590 Author: David 'Digit' Turner <digit@google.com> Date: Fri Aug 10 10:05:49 2018 android: crazy_linker: Better symbol search implementation. This CL improves a few functions related to symbol search and relocation. This prepares for a major change that will considerably change the way symbols are resolved during relocations and dlsym(), to better match default ELF semantics and help fix the component build as well. - Use a SearchResult result when looking for symbols, in order to allow symbols with a null address to be supported (this can happen for weak symbol exports). See SystemLinker::SearchResult and the related LibraryView::SearchResult struct definitions. - Ensure that SharedLibraryResolver properly releases its global scope handle on destruction. Since these correspond to a reference-counted global object, that will never be destroyed by the system linker, this was not a real resource leak, but is still the correct way to deal with this. - Add a comment to SharedLibraryResolver::Lookup() explaining why the code is written and will need to be refactored in a future CL. - Make LibraryView::LookupSymbol() const (finally!) - Use a few const references, instead of raw pointers when calling SharedLibrary::Relocate(). BUG=843987,802068 R=pasko@chromium.org, rmcilroy@chromium.org, agrieve@chromium.org android: crazy_linker: Minor cleanups. Minor cleanups to the code base. Preparing for future changes. BUG=NONE R=agrieve@chromium.org, pasko@chromium.org, rmcilroy@chromium.org Change-Id: I91c955c7be24e3738b118832c9ae8775934bc572 Reviewed-on: https://chromium-review.googlesource.com/1169603 Commit-Queue: David Turner <digit@chromium.org> Reviewed-by: agrieve <agrieve@chromium.org> Cr-Commit-Position: refs/heads/master@{#582103} [modify] https://crrev.com/a6a2898fbc25e7b76550954eea99df00a3fda590/third_party/android_crazy_linker/src/src/crazy_linker_api.cpp [modify] https://crrev.com/a6a2898fbc25e7b76550954eea99df00a3fda590/third_party/android_crazy_linker/src/src/crazy_linker_library_list.cpp [modify] https://crrev.com/a6a2898fbc25e7b76550954eea99df00a3fda590/third_party/android_crazy_linker/src/src/crazy_linker_library_list.h [modify] https://crrev.com/a6a2898fbc25e7b76550954eea99df00a3fda590/third_party/android_crazy_linker/src/src/crazy_linker_library_view.cpp [modify] https://crrev.com/a6a2898fbc25e7b76550954eea99df00a3fda590/third_party/android_crazy_linker/src/src/crazy_linker_library_view.h [modify] https://crrev.com/a6a2898fbc25e7b76550954eea99df00a3fda590/third_party/android_crazy_linker/src/src/crazy_linker_shared_library.cpp [modify] https://crrev.com/a6a2898fbc25e7b76550954eea99df00a3fda590/third_party/android_crazy_linker/src/src/crazy_linker_shared_library.h [modify] https://crrev.com/a6a2898fbc25e7b76550954eea99df00a3fda590/third_party/android_crazy_linker/src/src/crazy_linker_system_linker.cpp [modify] https://crrev.com/a6a2898fbc25e7b76550954eea99df00a3fda590/third_party/android_crazy_linker/src/src/crazy_linker_system_linker.h [modify] https://crrev.com/a6a2898fbc25e7b76550954eea99df00a3fda590/third_party/android_crazy_linker/src/src/crazy_linker_wrappers.cpp
Comment 1 by bugdroid1@chromium.org
, May 3 2018