Skip to content

Commit c918baf

Browse files
committed
Add config for ASAN builds.
Enables ASAN builds with e.g. bazel -c opt --config=asan <targets>
1 parent db8f471 commit c918baf

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/.bazelrc

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
11
# Enable Bzlmod for every Bazel command
22
common --enable_bzlmod
3-
common --cxxopt=-std=c++20
3+
common --cxxopt=-std=c++20
4+
5+
# Options to build with address sanitizer support.
6+
#
7+
# Example usage:
8+
# bazel build -c dbg --config=asan <targets>
9+
#
10+
# _GLIBCXX_SANITIZE_VECTOR is required to enable sanitizer checks in libstdc++
11+
build:asan --strip=never
12+
build:asan --copt=-fsanitize=address
13+
build:asan --copt=-DADDRESS_SANITIZER
14+
build:asan --copt=-D_GLIBCXX_SANITIZE_VECTOR
15+
build:asan --copt=-O1
16+
build:asan --copt=-g
17+
build:asan --copt=-fno-omit-frame-pointer
18+
build:asan --linkopt=-fsanitize=address

0 commit comments

Comments
 (0)