tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

BUILD.gn (2217B)


      1 # Copyright 2017 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/buildflag_header.gni")
      6 import("//chromium/build/config/coverage/coverage.gni")
      7 import("//chromium/build/config/rust.gni")
      8 
      9 config("default_coverage") {
     10   if (use_clang_coverage) {
     11     configs = []
     12     ldflags = []
     13     rustflags = []
     14     if (!is_win) {
     15       ldflags += [ "-fprofile-instr-generate" ]
     16     } else {
     17       # Windows directly calls link.exe instead of the compiler driver when
     18       # linking, and embeds the path to the profile runtime library as
     19       # dependent library into each object file.
     20       #
     21       # However... some build targets have no C++ object file (they have Rust
     22       # instead), and thus the linker ends up not pulling in the profile
     23       # library. So we add an edge to it directly.
     24       if (toolchain_has_rust) {
     25         configs += [ "//chromium/build/config/clang:compiler_profile" ]
     26       }
     27     }
     28 
     29     cflags = [
     30       "-fprofile-instr-generate",
     31       "-fcoverage-mapping",
     32       "-mllvm",
     33       "-runtime-counter-relocation=true",
     34 
     35       # Following experimental flags removes unused header functions from the
     36       # coverage mapping data embedded in the test binaries, and the reduction
     37       # of binary size enables building Chrome's large unit test targets on
     38       # MacOS. Please refer to crbug.com/796290 for more details.
     39       "-mllvm",
     40       "-limited-coverage-experimental=true",
     41     ]
     42 
     43     # Rust coverage is gated on using the Chromium-built Rust toolchain as it
     44     # needs to have a compatible LLVM version with the C++ compiler and the LLVM
     45     # tools that will be used to process the coverage output. This is because
     46     # the coverage file format is not stable.
     47     if (use_chromium_rust_toolchain) {
     48       rustflags += [
     49         "-Cinstrument-coverage",
     50         "-Cllvm-args=-runtime-counter-relocation",
     51       ]
     52     }
     53 
     54     if (is_linux || is_chromeos) {
     55       # TODO(crbug.com/40175589): Remove this flag.
     56       cflags += [ "-fno-use-cxa-atexit" ]
     57     }
     58   }
     59 }
     60 
     61 buildflag_header("buildflags") {
     62   header = "buildflags.h"
     63   flags = [ "USE_JAVASCRIPT_COVERAGE=$use_javascript_coverage" ]
     64 }