| # Copyright 2019 The Chromium Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/config/chromeos/ui_mode.gni") |
| |
| assert(is_chromeos) |
| |
| declare_args() { |
| # The location to a file used to dump symbols ordered by Call-Chain Clustering (C3) |
| # https://research.fb.com/wp-content/uploads/2017/01/cgo2017-hfsort-final1.pdf? |
| # to a file, used for generating orderfiles in Chrome OS |
| dump_call_chain_clustering_order = "" |
| } |
| |
| config("print_orderfile") { |
| if (dump_call_chain_clustering_order != "") { |
| _output_orderfile = |
| rebase_path(dump_call_chain_clustering_order, root_build_dir) |
| ldflags = [ "-Wl,--print-symbol-order=$_output_orderfile" ] |
| } |
| } |
| |
| config("compiler_cpu_abi") { |
| # Lacros currently uses the *-generic-crosstoolchain.gni files generated |
| # by the simplechrome sdk in build/args/chromeos. These target triples |
| # match the target toolchain defaults in these directories. Passing them |
| # redundantly is harmless and prepares for using Chromium's toolchain. |
| # Non-Lacros Chrome OS builds use per-board toolchains, which might use |
| # different triples. So don't do this there. |
| if (is_chromeos_device && is_chromeos_lacros) { |
| if (current_cpu == "x64") { |
| asmflags = [ "--target=x86_64-cros-linux-gnu" ] |
| cflags = [ "--target=x86_64-cros-linux-gnu" ] |
| ldflags = [ "--target=x86_64-cros-linux-gnu" ] |
| } else if (current_cpu == "arm") { |
| asmflags = [ "--target=armv7a-cros-linux-gnueabihf" ] |
| cflags = [ "--target=armv7a-cros-linux-gnueabihf" ] |
| ldflags = [ "--target=armv7a-cros-linux-gnueabihf" ] |
| } else if (current_cpu == "arm64") { |
| asmflags = [ "--target=aarch64-cros-linux-gnu" ] |
| cflags = [ "--target=aarch64-cros-linux-gnu" ] |
| ldflags = [ "--target=aarch64-cros-linux-gnu" ] |
| } else { |
| assert(false, "add support for $current_cpu here") |
| } |
| } |
| } |
| |
| config("runtime_library") { |
| # These flags are added by the Chrome OS toolchain compiler wrapper, |
| # or are implicitly passed by Chome OS's toolchain's clang due to the cmake |
| # flags that clang was built with. |
| # Passing them redundantly is harmless and prepares for using Chromium's |
| # toolchain for Lacros. |
| if (is_chromeos_device) { |
| ldflags = [ |
| "--rtlib=compiler-rt", |
| "--unwindlib=libunwind", |
| ] |
| } |
| } |