Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(802)

Unified Diff: build/common.gypi

Issue 843103003: android: Hide JNI exports by default. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use a blacklist instead of a whitelist Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: build/common.gypi
diff --git a/build/common.gypi b/build/common.gypi
index 719d75cc85c476fb5559102e00cd81740b647369..cd7b214a8fe9de3832338044ba88765c7a710b12 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -1796,9 +1796,6 @@
# Copy it out one scope.
'android_webview_build%': '<(android_webview_build)',
-
- # Default android linker script for shared library exports.
- 'android_linker_script%': '<(SHARED_INTERMEDIATE_DIR)/android_exports.lst',
}], # OS=="android"
['embedded==1', {
'use_system_fontconfig%': 0,
@@ -2471,6 +2468,14 @@
'-Wno-unnamed-type-template-args',
],
+ # By default, Android targets have their exported JNI symbols stripped,
+ # so we test the manual JNI registration code paths that are required
+ # when using the crazy linker. To allow use of native JNI exports (lazily
rmcilroy 2015/02/03 13:43:56 nit - maybe mention that binaries which set "use_c
+ # resolved by the JVM), targets can enable this variable, which will stop
+ # the stripping from happening. Only targets which do not need to be
+ # compatible with the crazy linker are permitted to set this.
+ 'use_native_jni_exports%': 0,
+
'conditions': [
['OS=="win" and component=="shared_library"', {
# See http://msdn.microsoft.com/en-us/library/aa652367.aspx
@@ -4589,10 +4594,19 @@
'-Wl,--no-undefined',
],
'conditions': [
- ['component=="static_library"', {
+ ['component=="static_library" and android_webview_build==0', {
'ldflags': [
'-Wl,--exclude-libs=ALL',
],
+ 'target_conditions': [
+ ['use_native_jni_exports==0', {
+ # Use a linker version script to strip JNI exports from
+ # binaries which have not specifically asked to use them.
+ 'ldflags': [
+ '-Wl,--version-script=<!(cd <(DEPTH) && pwd -P)/build/android/android_no_jni_exports.lst',
+ ],
+ }],
+ ],
}],
['clang==1', {
'cflags': [

Powered by Google App Engine
This is Rietveld 408576698