|
@@ -24,20 +24,23 @@ def cc_env():
|
|
|
it's difficult to modify default behaviors.
|
|
it's difficult to modify default behaviors.
|
|
|
"""
|
|
"""
|
|
|
|
|
|
|
|
- # On macOS, there's a nano zone allocation warning due to asan (arises
|
|
|
|
|
- # in fastbuild/dbg). This suppresses the warning in `bazel run`.
|
|
|
|
|
- #
|
|
|
|
|
- # Concatenation of a dict with a select isn't supported, so we concatenate
|
|
|
|
|
- # within the select.
|
|
|
|
|
- # https://github.com/bazelbuild/bazel/issues/12457
|
|
|
|
|
- return select({
|
|
|
|
|
- "//bazel/cc_toolchains:macos_asan": {
|
|
|
|
|
- "ASAN_SYMBOLIZER_PATH": llvm_symbolizer,
|
|
|
|
|
- "LLVM_SYMBOLIZER_PATH": llvm_symbolizer,
|
|
|
|
|
- "MallocNanoZone": "0",
|
|
|
|
|
- },
|
|
|
|
|
- "//conditions:default": {
|
|
|
|
|
- "ASAN_SYMBOLIZER_PATH": llvm_symbolizer,
|
|
|
|
|
- "LLVM_SYMBOLIZER_PATH": llvm_symbolizer,
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ # Settings which apply cross-platform.
|
|
|
|
|
+ # buildifier: disable=unsorted-dict-items
|
|
|
|
|
+ common_env = {
|
|
|
|
|
+ "LLVM_SYMBOLIZER_PATH": llvm_symbolizer,
|
|
|
|
|
+ # Sanitizers don't use LLVM as fallback, but sometimes ASAN may be used
|
|
|
|
|
+ # for UBSAN errors; we still set UBSAN in case it's directly used.
|
|
|
|
|
+ "ASAN_SYMBOLIZER_PATH": llvm_symbolizer,
|
|
|
|
|
+ "UBSAN_SYMBOLIZER_PATH": llvm_symbolizer,
|
|
|
|
|
+ # Default to printing traces for UBSAN.
|
|
|
|
|
+ "UBSAN_OPTIONS": "print_stacktrace=1",
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ # On macOS, there's a nano zone allocation warning when asan is enabled.
|
|
|
|
|
+ # This suppresses the warning in `bazel run`.
|
|
|
|
|
+ macos_env = {"MallocNanoZone": "0"}
|
|
|
|
|
+
|
|
|
|
|
+ return common_env | select({
|
|
|
|
|
+ "//bazel/cc_toolchains:macos_asan": macos_env,
|
|
|
|
|
+ "//conditions:default": {},
|
|
|
})
|
|
})
|