Revert of Android: Use linker script to hide all non-JNI symbols (patchset #1 id:1 of https://codereview.chromium.org/2683013002/ )
Reason for revert: This was the actual culprit, will re-land v8 rolls. Original issue's description: > Reland of Android: Use linker script to hide all non-JNI symbols (patchset #1 id:1 of https://codereview.chromium.org/2685933002/ ) > > Reason for revert: > Revert fixed WebKit Android (Nexus4) but... I also reverted https://codereview.chromium.org/2680943003 in parallel as EST sheriff... so now we don't know which one fixed it... tentatively relanding this one to see..! > > Original issue's description: > > Revert of Android: Use linker script to hide all non-JNI symbols (patchset #4 id:60001 of https://codereview.chromium.org/2633593004/ ) > > > > Reason for revert: > > Speculative revert, potential culprit for webkit_tests crashing on "WebKit Android (Nexus4)". > > > > Stack traces show not much else than JNI managed->native transitions and syscalls. > > > > Original issue's description: > > > Android: Use linker script to hide all non-JNI symbols > > > > > > The linker script is applied to all shared_library() targets by default, > > > just like the hide_jni one was. > > > > > > This reduces the size of libchrome.so by 220kb. > > > > > > BUG=448386 > > > CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.android:android_cronet_tester > > > > > > Review-Url: https://codereview.chromium.org/2633593004 > > > Cr-Commit-Position: refs/heads/master@{#448988} > > > Committed:6888d5002b
> > > > TBR=torne@chromium.org,digit@chromium.org,brettw@chromium.org,agrieve@chromium.org > > # Skipping CQ checks because original CL landed less than 1 days ago. > > NOPRESUBMIT=true > > NOTREECHECKS=true > > NOTRY=true > > BUG=448386 > > > > Review-Url: https://codereview.chromium.org/2685933002 > > Cr-Commit-Position: refs/heads/master@{#449028} > > Committed:de69a7c823
> > TBR=torne@chromium.org,digit@chromium.org,brettw@chromium.org,agrieve@chromium.org,engedy@chromium.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=448386 > > Review-Url: https://codereview.chromium.org/2683013002 > Cr-Commit-Position: refs/heads/master@{#449057} > Committed:59e1841b41
TBR=torne@chromium.org,digit@chromium.org,brettw@chromium.org,agrieve@chromium.org,engedy@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=448386 Review-Url: https://codereview.chromium.org/2684123002 Cr-Commit-Position: refs/heads/master@{#449096}
This commit is contained in:
android_webview
build
android
config
chrome/android
components/cronet/android
gpu
testing
third_party/netty-tcnative
tools/android/memconsumer
@ -312,8 +312,7 @@ shared_library("libwebviewchromium") {
|
||||
deps = [
|
||||
":webview_entry_point",
|
||||
]
|
||||
configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
|
||||
configs += [ "//build/config/android:hide_all_but_jni" ]
|
||||
configs -= [ "//build/config/android:hide_native_jni_exports" ]
|
||||
}
|
||||
|
||||
if (android_64bit_target_cpu) {
|
||||
@ -335,8 +334,7 @@ if (android_64bit_target_cpu) {
|
||||
deps = [
|
||||
":webview_entry_point",
|
||||
]
|
||||
configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
|
||||
configs += [ "//build/config/android:hide_all_but_jni" ]
|
||||
configs -= [ "//build/config/android:hide_native_jni_exports" ]
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,8 +93,7 @@ shared_library("libstandalonelibwebviewchromium") {
|
||||
deps = [
|
||||
"//android_webview:common",
|
||||
]
|
||||
configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
|
||||
configs += [ "//build/config/android:hide_all_but_jni" ]
|
||||
configs -= [ "//build/config/android:hide_native_jni_exports" ]
|
||||
}
|
||||
|
||||
instrumentation_test_apk("android_webview_test_apk") {
|
||||
@ -292,5 +291,5 @@ shared_library("libdrawgl") {
|
||||
sources = [
|
||||
"shell/src/draw_gl/draw_gl.cc",
|
||||
]
|
||||
configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
|
||||
configs -= [ "//build/config/android:hide_native_jni_exports" ]
|
||||
}
|
||||
|
17
build/android/android_no_jni_exports.lst
Normal file
17
build/android/android_no_jni_exports.lst
Normal file
@ -0,0 +1,17 @@
|
||||
# Copyright 2014 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
# This script makes all JNI exported symbols local, to prevent the JVM from
|
||||
# being able to find them, enforcing use of manual JNI function registration.
|
||||
# This is used for all Android binaries by default, unless they explicitly state
|
||||
# that they want JNI exported symbols to remain visible, as we need to ensure
|
||||
# the manual registration path is correct to maintain compatibility with the
|
||||
# crazy linker.
|
||||
# Check ld version script manual:
|
||||
# https://sourceware.org/binutils/docs-2.24/ld/VERSION.html#VERSION
|
||||
|
||||
{
|
||||
local:
|
||||
Java_*;
|
||||
};
|
@ -1,13 +0,0 @@
|
||||
# Copyright 2017 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
# Linker script that exports only JNI_OnLoad.
|
||||
# Should be used for libraries that do explicit JNI registration.
|
||||
|
||||
{
|
||||
global:
|
||||
JNI_OnLoad;
|
||||
local:
|
||||
*;
|
||||
};
|
@ -1,13 +0,0 @@
|
||||
# Copyright 2017 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
# Linker script that exports only symbols required for JNI to work.
|
||||
|
||||
{
|
||||
global:
|
||||
JNI_OnLoad;
|
||||
Java_*;
|
||||
local:
|
||||
*;
|
||||
};
|
@ -568,8 +568,10 @@ default_shared_library_configs = default_compiler_configs + [
|
||||
if (is_android) {
|
||||
# Strip native JNI exports from shared libraries by default. Binaries that
|
||||
# want this can remove this config.
|
||||
default_shared_library_configs +=
|
||||
[ "//build/config/android:hide_all_but_jni_onload" ]
|
||||
default_shared_library_configs += [
|
||||
"//build/config/android:hide_native_jni_exports",
|
||||
"//build/config/android:hide_all_but_jni_onload",
|
||||
]
|
||||
}
|
||||
set_defaults("shared_library") {
|
||||
configs = default_shared_library_configs
|
||||
@ -647,7 +649,10 @@ set_defaults("component") {
|
||||
if (is_component_build) {
|
||||
configs = default_shared_library_configs
|
||||
if (is_android) {
|
||||
configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
|
||||
configs -= [
|
||||
"//build/config/android:hide_native_jni_exports",
|
||||
"//build/config/android:hide_all_but_jni_onload",
|
||||
]
|
||||
}
|
||||
} else {
|
||||
configs = default_compiler_configs
|
||||
|
@ -195,14 +195,17 @@ config("executable_config") {
|
||||
ldflags = [ "-pie" ]
|
||||
}
|
||||
|
||||
config("hide_native_jni_exports") {
|
||||
ldflags = [ "-Wl,--version-script=" +
|
||||
rebase_path("//build/android/android_no_jni_exports.lst") ]
|
||||
}
|
||||
|
||||
config("hide_all_but_jni_onload") {
|
||||
ldflags = [ "-Wl,--version-script=" + rebase_path(
|
||||
"//build/android/android_only_explicit_jni_exports.lst") ]
|
||||
# TODO(agrieve): https://codereview.chromium.org/2633593004/
|
||||
}
|
||||
|
||||
config("hide_all_but_jni") {
|
||||
ldflags = [ "-Wl,--version-script=" +
|
||||
rebase_path("//build/android/android_only_jni_exports.lst") ]
|
||||
# TODO(agrieve): https://codereview.chromium.org/2633593004/
|
||||
}
|
||||
|
||||
# Instrumentation -------------------------------------------------------------
|
||||
|
@ -648,8 +648,7 @@ if (!android_64bit_target_cpu ||
|
||||
"//chrome:chrome_android_core",
|
||||
]
|
||||
|
||||
configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
|
||||
configs += [ "//build/config/android:hide_all_but_jni" ]
|
||||
configs -= [ "//build/config/android:hide_native_jni_exports" ]
|
||||
if (is_android && use_order_profiling) {
|
||||
deps += [ "//tools/cygprofile" ]
|
||||
}
|
||||
|
@ -264,6 +264,13 @@ shared_library("cronet") {
|
||||
"//base",
|
||||
"//net:net",
|
||||
]
|
||||
ldflags = [ "-Wl,--version-script=" +
|
||||
rebase_path("//components/cronet/android/only_jni_exports.lst") ]
|
||||
|
||||
# Avoid hide_native_jni_exports as it adds another version script, and the
|
||||
# ARM64 linker throws an error for multiple version scripts with anonymous
|
||||
# version tags.
|
||||
configs -= [ "//build/config/android:hide_native_jni_exports" ]
|
||||
}
|
||||
|
||||
cronet_api_srcjar_deps = [ ":cronet_api_version_srcjar" ]
|
||||
@ -545,6 +552,14 @@ shared_library("cronet_tests") {
|
||||
|
||||
include_dirs = [ _cronet_version_header_include_dir ]
|
||||
|
||||
ldflags = [ "-Wl,--version-script=" +
|
||||
rebase_path("//components/cronet/android/only_jni_exports.lst") ]
|
||||
|
||||
# Avoid hide_native_jni_exports as it adds another version script, and the
|
||||
# ARM64 linker throws an error for multiple version scripts with anonymous
|
||||
# version tags.
|
||||
configs -= [ "//build/config/android:hide_native_jni_exports" ]
|
||||
|
||||
if (cronet_enable_data_reduction_proxy_support) {
|
||||
deps += [ "//components/data_reduction_proxy/core/browser:browser_small" ]
|
||||
}
|
||||
|
10
components/cronet/android/only_jni_exports.lst
Normal file
10
components/cronet/android/only_jni_exports.lst
Normal file
@ -0,0 +1,10 @@
|
||||
# Copyright 2016 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
/* Make sure we don't export anything unneeded as it could cause conflicts
|
||||
with symbols from embedders. */
|
||||
global: JNI_OnLoad;
|
||||
local: *;
|
||||
};
|
@ -55,9 +55,6 @@ shared_library("command_buffer_gles2") {
|
||||
"COMMAND_BUFFER_GLES_LIB_SUPPORT_ONLY",
|
||||
"EGLAPIENTRY=",
|
||||
]
|
||||
if (is_android) {
|
||||
configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
|
||||
}
|
||||
if (current_os == "win") {
|
||||
defines += [ "EGLAPI=__declspec(dllexport)" ]
|
||||
} else {
|
||||
|
@ -59,7 +59,7 @@ template("test") {
|
||||
# the default shared_library configs rather than executable configs.
|
||||
configs -= [
|
||||
"//build/config:shared_library_config",
|
||||
"//build/config/android:hide_all_but_jni_onload",
|
||||
"//build/config/android:hide_native_jni_exports",
|
||||
]
|
||||
configs += [ "//build/config:executable_config" ]
|
||||
|
||||
|
2
third_party/netty-tcnative/BUILD.gn
vendored
2
third_party/netty-tcnative/BUILD.gn
vendored
@ -46,7 +46,7 @@ shared_library("netty-tcnative-so") {
|
||||
include_dirs = [ "../apache-portable-runtime/src/include" ]
|
||||
defines = [ "HAVE_OPENSSL" ]
|
||||
cflags = [ "-w" ]
|
||||
configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
|
||||
configs -= [ "//build/config/android:hide_native_jni_exports" ]
|
||||
deps = [
|
||||
"../apache-portable-runtime:apr",
|
||||
"../boringssl:boringssl",
|
||||
|
@ -30,7 +30,7 @@ shared_library("libmemconsumer") {
|
||||
"memconsumer_hook.cc",
|
||||
]
|
||||
libs = [ "log" ]
|
||||
configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
|
||||
configs -= [ "//build/config/android:hide_native_jni_exports" ]
|
||||
|
||||
configs -= [ "//build/config/compiler:chromium_code" ]
|
||||
configs += [ "//build/config/compiler:no_chromium_code" ]
|
||||
|
Reference in New Issue
Block a user