Commit 5158b6cf authored by Nico Weber's avatar Nico Weber Committed by Commit Bot

win: Clean up coverage linker flags after clang r360674.

After clang r360674, each .obj file embeds the path to the profile library
as a dependent lib. No intended behavior change.

Change-Id: Ie892fccdb8aaefc2545db56fb3274dc6f0992a96
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1630986Reviewed-by: default avatarHans Wennborg <hans@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#663751}
parent c30e29df
...@@ -17,22 +17,10 @@ config("pgo_instrumentation_flags") { ...@@ -17,22 +17,10 @@ config("pgo_instrumentation_flags") {
if (chrome_pgo_phase == 1) { if (chrome_pgo_phase == 1) {
if (is_clang) { if (is_clang) {
cflags = [ "-fprofile-instr-generate" ] cflags = [ "-fprofile-instr-generate" ]
if (is_win) { if (!is_win) {
# Normally, we pass -fprofile-instr-generate to the compiler and it # Windows directly calls link.exe instead of the compiler driver when
# automatically passes the right flags to the linker. # linking, and embeds the path to the profile runtime library as
# However, on Windows, we call the linker directly, without going # dependent library into each object file.
# through the compiler driver. This means we need to pass the right
# flags ourselves.
_clang_rt_base_path =
"$clang_base_path/lib/clang/$clang_version/lib/windows"
if (target_cpu == "x86") {
_clang_rt_suffix = "-i386.lib"
} else if (target_cpu == "x64") {
_clang_rt_suffix = "-x86_64.lib"
}
assert(_clang_rt_suffix != "", "target CPU $target_cpu not supported")
ldflags += [ "$_clang_rt_base_path/clang_rt.profile$_clang_rt_suffix" ]
} else {
ldflags += [ "-fprofile-instr-generate" ] ldflags += [ "-fprofile-instr-generate" ]
} }
} else if (is_win) { } else if (is_win) {
......
...@@ -8,21 +8,10 @@ config("default_coverage") { ...@@ -8,21 +8,10 @@ config("default_coverage") {
if (use_clang_coverage) { if (use_clang_coverage) {
ldflags = [] ldflags = []
if (!is_win) { if (!is_win) {
ldflags += [ "-fprofile-instr-generate" ]
} else {
# Windows directly calls link.exe instead of the compiler driver when # Windows directly calls link.exe instead of the compiler driver when
# linking. Hence, pass the runtime libraries instead of # linking, and embeds the path to the profile runtime library as
# -fsanitize=address. # dependent library into each object file.
# TODO(rnk): Come up with a more uniform approach for linking against ldflags += [ "-fprofile-instr-generate" ]
# 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 = [ cflags = [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment