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