summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorsl.ostapenko@samsung.com <sl.ostapenko@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-07 08:44:55 +0000
committersl.ostapenko@samsung.com <sl.ostapenko@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-07 08:44:55 +0000
commit1d70cc60526e7cb00f5e2f293f951f202ed016e6 (patch)
treea473590f0ffb07bbe0e834cd306cf62a70480ef8 /build
parent33ed90e0e7389ef045de283bbe2bdab2e3a91f4f (diff)
downloadchromium_src-1d70cc60526e7cb00f5e2f293f951f202ed016e6.zip
chromium_src-1d70cc60526e7cb00f5e2f293f951f202ed016e6.tar.gz
chromium_src-1d70cc60526e7cb00f5e2f293f951f202ed016e6.tar.bz2
Remove unneeded JNI registrations.
Rather than registering all jni bindings at startup, only get references to the class object for those files which require bindings. All others are satisfied by exporting symbols which can be found automatically by dalvik. This patch replaces excldue-libs=ALL with ld version script to strip unwanted symbols: https://sourceware.org/binutils/docs-2.24/ld/VERSION.html#VERSION BUG= Review URL: https://codereview.chromium.org/147533004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275652 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build')
-rw-r--r--build/android/android_exports.lst14
-rw-r--r--build/common.gypi19
-rw-r--r--build/jar_file_jni_generator.gypi1
-rw-r--r--build/jni_generator.gypi1
4 files changed, 27 insertions, 8 deletions
diff --git a/build/android/android_exports.lst b/build/android/android_exports.lst
new file mode 100644
index 0000000..820d6ec
--- /dev/null
+++ b/build/android/android_exports.lst
@@ -0,0 +1,14 @@
+# 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.
+
+# Default exports specification for chromium shared libraries on android.
+# Check ld version script manual:
+# https://sourceware.org/binutils/docs-2.24/ld/VERSION.html#VERSION
+
+{
+ global:
+ Java_*_native*;
+ JNI_OnLoad;
+ local: *;
+};
diff --git a/build/common.gypi b/build/common.gypi
index 73c2a44..a1a9b79 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -1731,6 +1731,9 @@
# Copy it out one scope.
'android_webview_build%': '<(android_webview_build)',
+
+ # Default android linker script for shared library exports.
+ 'android_linker_script%': '<!(cd <(DEPTH) && pwd -P)/build/android/android_exports.lst',
}], # OS=="android"
['android_webview_build==1', {
# When building the WebView in the Android tree, jarjar will remap all
@@ -4150,7 +4153,13 @@
},
'target_conditions': [
['_type=="shared_library"', {
- 'product_extension': '<(android_product_extension)',
+ 'product_extension': '<(android_product_extension)',
+ }],
+ ['_toolset=="target" and component=="static_library" and _type=="shared_library"', {
+ 'ldflags': [
+ # Only export symbols that are specified in version script.
+ '-Wl,--version-script=<(android_linker_script)',
+ ],
}],
# Settings for building device targets using Android's toolchain.
@@ -4216,8 +4225,7 @@
'ldflags': [
'-nostdlib',
'-Wl,--no-undefined',
- # Don't export symbols from statically linked libraries.
- '-Wl,--exclude-libs=ALL',
+
],
'libraries': [
'-l<(android_stlport_library)',
@@ -4228,11 +4236,6 @@
'-lm',
],
'conditions': [
- ['component=="shared_library"', {
- 'ldflags!': [
- '-Wl,--exclude-libs=ALL',
- ],
- }],
['clang==1', {
'cflags': [
# Work around incompatibilities between bionic and clang
diff --git a/build/jar_file_jni_generator.gypi b/build/jar_file_jni_generator.gypi
index dc43c49..59ab64e 100644
--- a/build/jar_file_jni_generator.gypi
+++ b/build/jar_file_jni_generator.gypi
@@ -54,6 +54,7 @@
'<(jni_generator_includes)',
'--optimize_generation',
'<(optimize_jni_generation)',
+ '--native_exports',
],
'message': 'Generating JNI bindings from <(input_jar_file)/<(input_java_class)',
'process_outputs_as_sources': 1,
diff --git a/build/jni_generator.gypi b/build/jni_generator.gypi
index da99331..da4b880 100644
--- a/build/jni_generator.gypi
+++ b/build/jni_generator.gypi
@@ -61,6 +61,7 @@
'<(jni_generator_jarjar_file)',
'--ptr_type',
'<(jni_generator_ptr_type)',
+ '--native_exports',
],
'message': 'Generating JNI bindings from <(RULE_INPUT_PATH)',
'process_outputs_as_sources': 1,