dart-sdk/build/config/sanitizers/BUILD.gn
Ryan Macnak 8e6191c7f9 [build] Include FPESAN in UBSAN.
TEST=ubsan
Bug: b/301044910
Change-Id: I608dd742a243bc1ab620c92da46e48270d6b060f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/327041
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-09-21 15:16:39 +00:00

63 lines
1.6 KiB
Plaintext

# Copyright 2014 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/sanitizers/sanitizers.gni")
# Contains the dependencies needed for sanitizers to link into executables and
# shared_libraries. Unconditionally depend upon this target as it is empty if
# |is_asan|, |is_lsan|, |is_tsan|, |is_msan| and |use_custom_libcxx| are false.
group("deps") {
deps = [ "//third_party/instrumented_libraries:deps" ]
if (is_asan || is_lsan || is_msan || is_tsan || is_ubsan) {
public_configs = [ ":sanitizer_options_link_helper" ]
deps += [ ":options_sources" ]
}
if (use_custom_libcxx) {
deps += [ "//buildtools/third_party/libc++:libcxx_proxy" ]
}
}
config("sanitizer_options_link_helper") {
ldflags = [ "-Wl,-u_sanitizer_options_link_helper" ]
if (is_asan) {
ldflags += [ "-fsanitize=address" ]
}
if (is_lsan) {
ldflags += [ "-fsanitize=leak" ]
}
if (is_msan) {
ldflags += [ "-fsanitize=memory" ]
}
if (is_tsan) {
ldflags += [ "-fsanitize=thread" ]
}
if (is_ubsan) {
ldflags += [
"-fsanitize=undefined",
"-fsanitize=float-divide-by-zero",
"-fsanitize=float-cast-overflow",
]
}
}
source_set("options_sources") {
visibility = [
":deps",
"//:gn_visibility",
]
sources = [ "//build/sanitizers/sanitizer_options.cc" ]
if (is_asan) {
sources += [ "//build/sanitizers/asan_suppressions.cc" ]
}
if (is_lsan) {
sources += [ "//build/sanitizers/lsan_suppressions.cc" ]
}
if (is_tsan) {
sources += [ "//build/sanitizers/tsan_suppressions.cc" ]
}
}