From 45f274deacdc195b5ed3c4b837f16ff2c6a7a77b Mon Sep 17 00:00:00 2001 From: Tyler Yankee Date: Fri, 27 Feb 2026 09:30:58 -0500 Subject: [PATCH] Add LSan feature to UNIX toolchain Mirror the existing sanitizer features with the appropriate leak sanitizer flags. --- cc/private/toolchain/unix_cc_toolchain_config.bzl | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cc/private/toolchain/unix_cc_toolchain_config.bzl b/cc/private/toolchain/unix_cc_toolchain_config.bzl index 86480f8d8..6815e9f16 100644 --- a/cc/private/toolchain/unix_cc_toolchain_config.bzl +++ b/cc/private/toolchain/unix_cc_toolchain_config.bzl @@ -1690,6 +1690,17 @@ def _impl(ctx): ], ) + lsan_feature = _sanitizer_feature( + name = "lsan", + specific_compile_flags = [ + "-fsanitize=leak", + "-fno-common", + ], + specific_link_flags = [ + "-fsanitize=leak", + ], + ) + tsan_feature = _sanitizer_feature( name = "tsan", specific_compile_flags = [ @@ -1839,6 +1850,7 @@ def _impl(ctx): supports_pic_feature, prefer_pic_for_opt_binaries_feature, asan_feature, + lsan_feature, tsan_feature, ubsan_feature, gcc_quoting_for_param_files_feature, @@ -1891,6 +1903,7 @@ def _impl(ctx): libtool_feature, archiver_flags_feature, asan_feature, + lsan_feature, tsan_feature, ubsan_feature, gcc_quoting_for_param_files_feature,