Commit 837e304b authored by Jonathan Metzman's avatar Jonathan Metzman Committed by Commit Bot

[libFuzzer][Windows]Enable building fuzz targets on Windows.

Bug: 888363
Change-Id: Idfb7c644fa3294ad11327609b4b39eacfd3f5dd2
Reviewed-on: https://chromium-review.googlesource.com/1238917Reviewed-by: default avatarDirk Pranke <dpranke@chromium.org>
Reviewed-by: default avatarMax Moroz <mmoroz@chromium.org>
Commit-Queue: Jonathan Metzman <metzman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#594525}
parent 73942166
...@@ -690,8 +690,8 @@ group("gn_all") { ...@@ -690,8 +690,8 @@ group("gn_all") {
} }
} }
if ((is_linux && !is_chromeos && !is_chromecast) || (is_win && use_drfuzz) || if ((is_linux && !is_chromeos && !is_chromecast) ||
(use_libfuzzer && is_mac)) { (is_win && (use_drfuzz || use_libfuzzer)) || (use_libfuzzer && is_mac)) {
deps += [ deps += [
"//testing/libfuzzer/fuzzers", "//testing/libfuzzer/fuzzers",
"//testing/libfuzzer/tests:libfuzzer_tests", "//testing/libfuzzer/tests:libfuzzer_tests",
......
...@@ -227,29 +227,38 @@ config("default_sanitizer_ldflags") { ...@@ -227,29 +227,38 @@ config("default_sanitizer_ldflags") {
} }
} }
} }
} else if (is_win && is_asan) { } else if (is_win) {
# 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 -fsanitize=address. # linking. Hence, pass the runtime libraries instead of -fsanitize=address
# In the static-library build, libraries are different for executables # or -fsanitize=fuzzer.
# and dlls, see link_executable and link_shared_library below. if (is_asan && is_component_build) {
# In the static-library build, ASan libraries are different for
# executables and dlls, see link_executable and link_shared_library below.
# This here handles only the component build. # This here handles only the component build.
if (target_cpu == "x64") { if (target_cpu == "x64") {
# Windows 64-bit. # Windows 64-bit.
if (is_component_build) {
libs = [ libs = [
"clang_rt.asan_dynamic-x86_64.lib", "clang_rt.asan_dynamic-x86_64.lib",
"clang_rt.asan_dynamic_runtime_thunk-x86_64.lib", "clang_rt.asan_dynamic_runtime_thunk-x86_64.lib",
] ]
}
} else { } else {
assert(target_cpu == "x86", "WinASan unsupported architecture") assert(target_cpu == "x86", "WinASan unsupported architecture")
if (is_component_build) {
libs = [ libs = [
"clang_rt.asan_dynamic-i386.lib", "clang_rt.asan_dynamic-i386.lib",
"clang_rt.asan_dynamic_runtime_thunk-i386.lib", "clang_rt.asan_dynamic_runtime_thunk-i386.lib",
] ]
} }
} }
if (use_libfuzzer) {
assert(target_cpu == "x64", "LibFuzzer unsupported architecture")
assert(!is_component_build,
"LibFuzzer only supports non-component builds on Windows")
# Incremental linking causes padding that messes up SanitizerCoverage.
# Don't do it.
ldflags = [ "/INCREMENTAL:NO" ]
libs = [ "clang_rt.fuzzer_no_main-x86_64.lib" ]
}
} }
} }
......
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