embed_sections.gni (1324B)
1 # Copyright 2024 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 # Embed elf section information of a binary into the binary's predefined 8 # symbols. 9 # 10 # Args: 11 # binary_input: Path to the chrome binary, e.g.: 12 # "$root_out_dir/chrome" 13 # sections_embedded_binary_output: Desired output file for embedded binary, 14 # e.g.: "$root_out_dir/chrome.sections_embedded" 15 template("embed_sections") { 16 forward_variables_from(invoker, 17 [ 18 "deps", 19 "testonly", 20 ]) 21 action("${target_name}") { 22 script = "//chromium/build/chromeos/embed_sections.py" 23 24 if (defined(invoker.sections_embedded_binary_output)) { 25 sections_embedded_binary_output = invoker.sections_embedded_binary_output 26 } else { 27 sections_embedded_binary_output = 28 invoker.binary_input + ".sections_embedded" 29 } 30 31 inputs = [ invoker.binary_input ] 32 outputs = [ sections_embedded_binary_output ] 33 args = [ 34 "--binary-input", 35 rebase_path(invoker.binary_input, root_build_dir), 36 "--binary-output", 37 rebase_path(sections_embedded_binary_output, root_build_dir), 38 ] 39 } 40 }