Skip to content

Commit

Permalink
Rename libv8.so to libv8android.so
Browse files Browse the repository at this point in the history
Summary:
    On some Android device, there is libv8.so in system ROM.
    E.g. /system/lib/libv8.so or /vendor/lib/libv8.so

    On old Android, dlopen() with RTLD_GLOBAL is not handled well and it's by default RTLD_LOCAL.
    Even we call System.loadLibrary("v8") before,
    during the time RNV8 call System.loadLibrary("v8executor") and search libv8.so in DT_NEEDED.
    It seems bionic linker will use system libv8.so instead of ours.
    Since our libv8.so is customized with libplatform.so, this leads to unresolved symbol as
    Kudo/react-native-v8#29.

    That's why I am proposing to rename libv8.so as libv8android.so and to prevent name conflict from system libv8.so.

    Reference for RTLD_GLOBAL: android/ndk#201
  • Loading branch information
Kudo committed Nov 7, 2019
1 parent 48c4457 commit 5ba6d53
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions patches/v8_shared_library.patch
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ index c486f1a..6aeb762 100644
@@ -3813,6 +3805,23 @@ v8_static_library("wee8") {
]
}
+v8_loadable_module("libv8") {

+v8_loadable_module("libv8android") {
+ defines = [ "BUILDING_V8_SHARED" ]
+
+ sources = [
Expand Down
6 changes: 3 additions & 3 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ function build_arch()
if [[ ${MKSNAPSHOT_ONLY} -eq "1" ]]; then
date ; ninja ${NINJA_PARAMS} -C out.v8.$arch run_mksnapshot_default ; date
else
date ; ninja ${NINJA_PARAMS} -C out.v8.$arch libv8 ; date
date ; ninja ${NINJA_PARAMS} -C out.v8.$arch libv8android ; date

mkdir -p $BUILD_DIR/lib/$arch_for_android
cp -f out.v8.$arch/libv8.so $BUILD_DIR/lib/$arch_for_android/libv8.so
cp -f out.v8.$arch/libv8android.so $BUILD_DIR/lib/$arch_for_android/libv8android.so
mkdir -p $BUILD_DIR/lib.unstripped/$arch_for_android
cp -f out.v8.$arch/lib.unstripped/libv8.so $BUILD_DIR/lib.unstripped/$arch_for_android/libv8.so
cp -f out.v8.$arch/lib.unstripped/libv8android.so $BUILD_DIR/lib.unstripped/$arch_for_android/libv8android.so
fi

mkdir -p $BUILD_DIR/tools/$arch_for_android
Expand Down

0 comments on commit 5ba6d53

Please sign in to comment.