1# Copyright 2018 The Chromium Authors 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5import("//build/config/android/config.gni") 6import("//build/config/python.gni") 7if (build_with_chromium) { 8 import("//third_party/jni_zero/jni_zero.gni") 9} 10 11# Generate a custom linker version script that can later be used with 12# "-Wl,--version-script=<path>" ldflags. 13# 14# Variables: 15# export_java_symbols: Optional. If true, also export all Java_* symbols 16# exported for JNI. 17# export_symbol_allowlist_files: Optional. List of paths to input files containing 18# lists of symbols to export. 19# linker_script: Path to output linker version script. 20# 21template("generate_linker_version_script") { 22 action_with_pydeps(target_name) { 23 forward_variables_from(invoker, TESTONLY_AND_VISIBILITY) 24 script = "//build/android/gyp/generate_linker_version_script.py" 25 outputs = [ invoker.linker_script ] 26 inputs = [] 27 args = [ "--output=" + rebase_path(invoker.linker_script, root_build_dir) ] 28 29 if (defined(invoker.testonly) && invoker.testonly) { 30 args += [ "--export-fortesting-java-symbols" ] 31 } 32 if (enable_jni_multiplexing) { 33 args += [ "--jni-multiplexing" ] 34 } 35 36 if (defined(invoker.export_feature_registrations) && 37 invoker.export_feature_registrations) { 38 args += [ "--export-feature-registrations" ] 39 } 40 41 if (defined(invoker.export_symbol_allowlist_files)) { 42 foreach(file_, invoker.export_symbol_allowlist_files) { 43 inputs += [ file_ ] 44 args += [ 45 "--export-symbol-allowlist-file", 46 rebase_path(file_, root_build_dir), 47 ] 48 } 49 } 50 } 51} 52