strip_binary.gni (1775B)
1 # Copyright 2021 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 5 import("//chromium/build/toolchain/toolchain.gni") 6 7 # Extracts symbols from a binary into a symbol file. 8 # 9 # Args: 10 # binary_input: Path to the binary containing symbols to extract, e.g.: 11 # "$root_out_dir/chrome" 12 # symbol_output: Desired output file for symbols, e.g.: 13 # "$root_out_dir/chrome.debug" 14 # stripped_binary_output: Desired output file for stripped file, e.g.: 15 # "$root_out_dir/chrome.stripped" 16 template("strip_binary") { 17 forward_variables_from(invoker, 18 [ 19 "deps", 20 "testonly", 21 ]) 22 action("${target_name}") { 23 eu_strip_binary = "//buildtools/third_party/eu-strip/bin/eu-strip" 24 script = "//chromium/build/linux/strip_binary.py" 25 26 if (defined(invoker.stripped_binary_output)) { 27 stripped_binary_output = invoker.stripped_binary_output 28 } else { 29 stripped_binary_output = invoker.binary_input + ".stripped" 30 } 31 if (defined(invoker.symbol_output)) { 32 symbol_output = invoker.symbol_output 33 } else { 34 symbol_output = invoker.binary_input + ".debug" 35 } 36 37 inputs = [ 38 invoker.binary_input, 39 eu_strip_binary, 40 ] 41 outputs = [ 42 symbol_output, 43 stripped_binary_output, 44 ] 45 args = [ 46 "--eu-strip-binary-path", 47 rebase_path(eu_strip_binary, root_build_dir), 48 "--symbol-output", 49 rebase_path(symbol_output, root_build_dir), 50 "--stripped-binary-output", 51 rebase_path(stripped_binary_output, root_build_dir), 52 "--binary-input", 53 rebase_path(invoker.binary_input, root_build_dir), 54 ] 55 } 56 }