| Index: build/config/android/rules.gni
|
| diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni
|
| index 76fda46bce3b2bfd517c63dbd0aff5dafa8e91d0..2db732acd73d9a99c40ac406266a22ce14444fac 100644
|
| --- a/build/config/android/rules.gni
|
| +++ b/build/config/android/rules.gni
|
| @@ -6,10 +6,10 @@ import("//base/android/linker/config.gni")
|
| import("//build/config/android/config.gni")
|
| import("//build/config/android/internal_rules.gni")
|
| import("//tools/grit/grit_rule.gni")
|
| +import("//tools/relocation_packer/config.gni")
|
|
|
| assert(is_android)
|
|
|
| -
|
| # Declare a jni target
|
| #
|
| # This target generates the native jni bindings for a set of .java files.
|
| @@ -958,9 +958,6 @@ template("android_apk") {
|
| }
|
|
|
| _load_library_from_apk = false
|
| - if (defined(invoker.load_library_from_apk)) {
|
| - _load_library_from_apk = invoker.load_library_from_apk
|
| - }
|
|
|
| if (defined(invoker.native_libs)) {
|
| _use_chromium_linker = false
|
| @@ -969,6 +966,21 @@ template("android_apk") {
|
| chromium_linker_supported)
|
| }
|
|
|
| + if (defined(invoker.load_library_from_apk) &&
|
| + invoker.load_library_from_apk) {
|
| + _load_library_from_apk = true
|
| + assert(_use_chromium_linker, "Loading library from the apk requires use" +
|
| + " of the Chromium linker.")
|
| + }
|
| +
|
| + _enable_relocation_packing = false
|
| + if (defined(invoker.enable_relocation_packing) &&
|
| + invoker.enable_relocation_packing) {
|
| + _enable_relocation_packing = relocation_packing_supported
|
| + assert(_use_chromium_linker, "Relocation packing requires use of the" +
|
| + " Chromium linker.")
|
| + }
|
| +
|
| _native_libs = invoker.native_libs
|
| _native_libs_dir = base_path + "/libs"
|
|
|
| @@ -1090,19 +1102,48 @@ template("android_apk") {
|
| }
|
|
|
| if (_native_libs != []) {
|
| - copy_ex("${_template_name}__prepare_native") {
|
| - clear_dir = true
|
| + action("${_template_name}__prepare_native") {
|
| + script = "//build/android/gyp/pack_arm_relocations.py"
|
| + packed_libraries_dir = "$_native_libs_dir/$android_app_abi"
|
| + depfile = "$target_gen_dir/$target_name.d"
|
| + outputs = [
|
| + depfile
|
| + ]
|
| inputs = [
|
| build_config
|
| ]
|
| - dest = "$_native_libs_dir/$android_app_abi"
|
| + deps = []
|
| + skip_packing_list = [
|
| + "gdbserver",
|
| + "libchromium_android_linker.so",
|
| + ]
|
| +
|
| + enable_packing_arg = 0
|
| + if (_enable_relocation_packing) {
|
| + enable_packing_arg = 1
|
| + deps += [
|
| + relocation_packer_target
|
| + ]
|
| + }
|
| +
|
| args = [
|
| - "--files=@FileArg(${_rebased_build_config}:native:libraries)",
|
| + "--depfile", rebase_path(depfile, root_build_dir),
|
| + "--enable-packing=$enable_packing_arg",
|
| + "--has-relocations-with-addends=$relocations_have_addends",
|
| + "--exclude-packing-list=$skip_packing_list",
|
| + "--android-pack-relocations", rebase_path(relocation_packer_exe, root_build_dir),
|
| + "--android-objcopy", rebase_path(android_objcopy, root_build_dir),
|
| + "--stripped-libraries-dir", rebase_path(root_build_dir, root_build_dir),
|
| + "--packed-libraries-dir", rebase_path(packed_libraries_dir, root_build_dir),
|
| + "--libraries=@FileArg(${_rebased_build_config}:native:libraries)",
|
| + "--clear-dir"
|
| ]
|
| +
|
| if (is_debug) {
|
| - rebased_gdbserver = rebase_path(android_gdbserver, root_build_dir)
|
| + rebased_gdbserver = rebase_path([ android_gdbserver ], root_build_dir)
|
| + inputs += [ android_gdbserver ]
|
| args += [
|
| - "--files=[\"$rebased_gdbserver\"]"
|
| + "--libraries=$rebased_gdbserver"
|
| ]
|
| }
|
| }
|
|
|