libchrome.so linked with lld not loadable by crazylinker |
|||
Issue descriptionGN Args: target_os = "android" is_debug = false symbol_level = 1 is_official_build = true use_lld = true is_chrome_branded = true 1. Obtain a build of ld.lld that can link libchrome.so 2. Build chrome_public_apk 3. Run on a kitkat device via out/Release/bin/chrome_public_apk run Logcat doesn't have much of use in it: 10-27 15:41:23.711 7912 7965 I cr_LibraryLoader: Loading chrome 10-27 15:41:23.711 7912 7965 E cr_ChromiumAndroidLinker: Open: Could not open libchrome.so: Can't find library file libchrome.so 10-27 15:41:23.711 7912 7965 E cr_LibraryLoader: Unable to load library: libchrome.so 10-27 15:41:23.711 7912 7965 E cr_LibraryLoader: Unable to load library: chrome Chrome opens fine on my O device, so that's why I think it's a crazylinker issue.
,
Oct 30 2017
,
Oct 31 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/eb412d9686ae92bc8cbe2f1c380b8db013130e9b commit eb412d9686ae92bc8cbe2f1c380b8db013130e9b Author: Peter Collingbourne <pcc@chromium.org> Date: Tue Oct 31 01:45:47 2017 Android: Determine search path by taking the address of a function instead of a variable. The GetCrazyContext function calls the crazy_context_add_search_path_for_address function to add the directory where the crazy linker library was loaded from to the search path. This function works by reading /proc/self/maps to discover the path of the file from which the address passed as the second argument is mapped, which is expected to be the crazy linker library. However, there is no guarantee that the address of a static variable such as s_crazy_context will be mapped; the linker may allocate them into an unmapped region of the r/w segment. This happens to be what lld does with this variable. Because the address was not mapped, we ended up failing to determine the search path, which led to a failure to load libchrome.so in pre-modern APKs. We can more reasonably rely on functions being memory mapped, so this change causes us to take the address of a function instead. Bug: 779185 Change-Id: I83cd882567c48a2cca443b7f5781c50ebc1b9bb4 Reviewed-on: https://chromium-review.googlesource.com/745201 Reviewed-by: agrieve <agrieve@chromium.org> Commit-Queue: Peter Collingbourne <pcc@chromium.org> Cr-Commit-Position: refs/heads/master@{#512698} [modify] https://crrev.com/eb412d9686ae92bc8cbe2f1c380b8db013130e9b/base/android/linker/legacy_linker_jni.cc
,
Oct 31 2017
|
|||
►
Sign in to add a comment |
|||
Comment 1 by p...@chromium.org
, Oct 27 2017