• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
5import("//build/config/android/rules.gni")
6
7unwind_table_asset_v2_filename = "unwind_cfi_32_v2"
8
9_dump_syms_target = "//third_party/breakpad:dump_syms($host_toolchain)"
10_dump_syms = get_label_info(_dump_syms_target, "root_out_dir") + "/dump_syms"
11_readobj_path = "$clang_base_path/bin/llvm-readobj"
12
13template("unwind_table_v2") {
14  action(target_name) {
15    forward_variables_from(invoker, TESTONLY_AND_VISIBILITY)
16    _output_path =
17        "$target_out_dir/$target_name/$unwind_table_asset_v2_filename"
18
19    # Strip the "lib" prefix, if present. Add and then remove a space because
20    # our ownly tool is "replace all".
21    _library_name = get_label_info(invoker.library_target, "name")
22    _library_name =
23        string_replace(string_replace(" $_library_name", " $shlib_prefix", ""),
24                       " ",
25                       "")
26    _library_path = "$root_out_dir/lib.unstripped/$shlib_prefix$_library_name$shlib_extension"
27
28    script = "//build/android/gyp/create_unwind_table.py"
29    outputs = [ _output_path ]
30    inputs = [
31      _dump_syms,
32      _library_path,
33    ]
34    deps = [
35      _dump_syms_target,
36      invoker.library_target,
37    ]
38
39    args = [
40      "--input_path",
41      rebase_path(_library_path, root_build_dir),
42      "--output_path",
43      rebase_path(_output_path, root_build_dir),
44      "--dump_syms_path",
45      rebase_path(_dump_syms, root_build_dir),
46      "--readobj_path",
47      rebase_path(_readobj_path, root_build_dir),
48    ]
49  }
50}
51