Skip to content

Upstream --features=lsan support to rules_cc #24116

@tyler-yankee

Description

@tyler-yankee

Is your feature request related to a problem? Please describe.

One of the big enhancements in #24090 was to swap out our custom sanitizer flags with upstream Bazel (in particular, rules_cc) --features=(asan|ubsan|tsan). However, they currently don't support --features=lsan, so we still have our custom flags there, which are:

--copt=-fsanitize=leak
--copt=-fno-common
--copt=-fno-omit-frame-pointer
--link-opt=-fsanitize=leak

This is analogous to the ASan flags, but with leak instead.

Describe the solution you'd like

Add upstream support to rules_cc for --features=lsan, and replace our custom implementation. We should use our current flags specified above as a starting point, do some research to make sure those are reasonable, and then defer to upstream's decision during review.

Describe alternatives you've considered

Continue to use our existing implementation. This is mostly fine, but inconsistent with how the rest of the sanitizers are done. It likely means that we'll miss any flags added to other upstream --features when really we should be using them also.

Additional context

See https://github.com/bazelbuild/rules_cc/blob/9aad5c688ca8d5bef4b5f14b9cfbb0d829bf0ccd/cc/private/toolchain/unix_cc_toolchain_config.bzl#L1709-L1738 for the implementation.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

In review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions