Chromium Code Reviews| Index: build/config/android/rules.gni |
| diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni |
| index 2bb432d4dc888710365a8c4254d65fb5facd5e52..d012ae70fd8db4d54b7c474e32be8e176aecada8 100644 |
| --- a/build/config/android/rules.gni |
| +++ b/build/config/android/rules.gni |
| @@ -5,10 +5,10 @@ |
| 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. |
| @@ -837,6 +837,17 @@ template("android_apk") { |
| } |
| assert(_use_chromium_linker || true) |
| + _enable_relocation_packing = false |
| + if (defined(invoker.enable_relocation_packing)) { |
| + _enable_relocation_packing = invoker.enable_relocation_packing |
| + } |
| + assert(_enable_relocation_packing || true) |
|
simonb (inactive)
2014/10/20 13:06:09
Does this do anything? (Also for _use_chromium_li
|
| + |
| + if (_enable_relocation_packing) { |
| + assert(_use_chromium_linker, "Relocation packing requires use of the" + |
| + "Chromium linker.") |
| + } |
| + |
| _load_library_from_apk = false |
| if (defined(invoker.load_library_from_apk)) { |
| _load_library_from_apk = invoker.load_library_from_apk |
| @@ -865,6 +876,10 @@ template("android_apk") { |
| _use_chromium_linker = false |
| } |
| + if (!_use_chromium_linker || !relocation_packing_supported) { |
| + _enable_relocation_packing = false |
| + } |
| + |
| _native_libs = invoker.native_libs |
| _native_libs_dir = base_path + "/libs" |
| @@ -986,19 +1001,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" |
| ] |
| } |
| } |