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") 7 8# Generate a custom linker version script that can later be used with 9# "-Wl,--version-script=<path>" ldflags. 10# 11# Variables: 12# export_java_symbols: Optional. If true, also export all Java_* symbols 13# exported for JNI. 14# export_symbol_allowlist_files: Optional. List of paths to input files containing 15# lists of symbols to export. 16# linker_script: Path to output linker version script. 17# 18template("generate_linker_version_script") { 19 action_with_pydeps(target_name) { 20 forward_variables_from(invoker, TESTONLY_AND_VISIBILITY) 21 script = "//build/android/gyp/generate_linker_version_script.py" 22 outputs = [ invoker.linker_script ] 23 inputs = [] 24 args = [ "--output=" + rebase_path(invoker.linker_script, root_build_dir) ] 25 26 if (defined(invoker.testonly) && invoker.testonly) { 27 args += [ "--export-fortesting-java-symbols" ] 28 } 29 if (allow_jni_multiplexing) { 30 args += [ "--jni-multiplexing" ] 31 } 32 33 if (defined(invoker.export_feature_registrations) && 34 invoker.export_feature_registrations) { 35 args += [ "--export-feature-registrations" ] 36 } 37 38 if (defined(invoker.export_symbol_allowlist_files)) { 39 foreach(file_, invoker.export_symbol_allowlist_files) { 40 inputs += [ file_ ] 41 args += [ 42 "--export-symbol-allowlist-file", 43 rebase_path(file_, root_build_dir), 44 ] 45 } 46 } 47 } 48} 49