summaryrefslogtreecommitdiff
path: root/deps/v8/build/config/coverage/BUILD.gn
blob: 2604411aea877a0b182450905c4bd0e573a2ae00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/coverage/coverage.gni")

config("default_coverage") {
  if (use_clang_coverage) {
    ldflags = []
    if (!is_win) {
      ldflags += [ "-fprofile-instr-generate" ]
    } else {
      # Windows directly calls link.exe instead of the compiler driver when
      # linking.  Hence, pass the runtime libraries instead of
      # -fsanitize=address.
      # TODO(rnk): Come up with a more uniform approach for linking against
      # compiler-rt for sanitizers and coverage.
      if (target_cpu == "x64") {
        ldflags += [ "clang_rt.profile-x86_64.lib" ]
      } else if (target_cpu == "x86") {
        ldflags += [ "clang_rt.profile-i386.lib" ]
      } else {
        assert(false &&
               "use_clang_coverage=true not supported yet for this target_cpu")
      }
    }

    cflags = [
      "-fprofile-instr-generate",
      "-fcoverage-mapping",

      # Following experimental flags removes unused header functions from the
      # coverage mapping data embedded in the test binaries, and the reduction
      # of binary size enables building Chrome's large unit test targets on
      # MacOS. Please refer to crbug.com/796290 for more details.
      "-mllvm",
      "-limited-coverage-experimental=true",
    ]

    if (!is_win) {
      cflags += [ "-fno-use-cxa-atexit" ]
    }
  }
}