• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2019 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/chromeos/ui_mode.gni")
6
7assert(is_chromeos)
8
9declare_args() {
10  # The location to a file used to dump symbols ordered by Call-Chain Clustering (C3)
11  # https://research.fb.com/wp-content/uploads/2017/01/cgo2017-hfsort-final1.pdf?
12  # to a file, used for generating orderfiles in Chrome OS
13  dump_call_chain_clustering_order = ""
14}
15
16config("print_orderfile") {
17  if (dump_call_chain_clustering_order != "") {
18    _output_orderfile =
19        rebase_path(dump_call_chain_clustering_order, root_build_dir)
20    ldflags = [ "-Wl,--print-symbol-order=$_output_orderfile" ]
21  }
22}
23
24config("compiler_cpu_abi") {
25  # Lacros currently uses the *-generic-crosstoolchain.gni files generated
26  # by the simplechrome sdk in build/args/chromeos. These target triples
27  # match the target toolchain defaults in these directories. Passing them
28  # redundantly is harmless and prepares for using Chromium's toolchain.
29  # Non-Lacros Chrome OS builds use per-board toolchains, which might use
30  # different triples. So don't do this there.
31  if (is_chromeos_device && is_chromeos_lacros) {
32    if (current_cpu == "x64") {
33      asmflags = [ "--target=x86_64-cros-linux-gnu" ]
34      cflags = [ "--target=x86_64-cros-linux-gnu" ]
35      ldflags = [ "--target=x86_64-cros-linux-gnu" ]
36    } else if (current_cpu == "arm") {
37      asmflags = [ "--target=armv7a-cros-linux-gnueabihf" ]
38      cflags = [ "--target=armv7a-cros-linux-gnueabihf" ]
39      ldflags = [ "--target=armv7a-cros-linux-gnueabihf" ]
40    } else if (current_cpu == "arm64") {
41      asmflags = [ "--target=aarch64-cros-linux-gnu" ]
42      cflags = [ "--target=aarch64-cros-linux-gnu" ]
43      ldflags = [ "--target=aarch64-cros-linux-gnu" ]
44    } else {
45      assert(false, "add support for $current_cpu here")
46    }
47  }
48}
49
50config("runtime_library") {
51  # These flags are added by the Chrome OS toolchain compiler wrapper,
52  # or are implicitly passed by Chome OS's toolchain's clang due to the cmake
53  # flags that clang was built with.
54  # Passing them redundantly is harmless and prepares for using Chromium's
55  # toolchain for Lacros.
56  if (is_chromeos_device) {
57    ldflags = [
58      "--rtlib=compiler-rt",
59      "--unwindlib=libunwind",
60    ]
61  }
62}
63