Skip to content

Commit e74f8a0

Browse files
committed
Correct bazel's asan build to use the right malloc library
Previously openroad just segfaulted on startup due to a tcmalloc incompatibility. Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
1 parent 85e2a26 commit e74f8a0

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

.bazelrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ build:asan --copt=-O1
108108
build:asan --copt=-g
109109
build:asan --copt=-fno-omit-frame-pointer
110110
build:asan --linkopt=-fsanitize=address
111+
# TCMalloc is incompatible with ASan: __asan_init's interceptor setup calls
112+
# dlsym -> malloc before TCMalloc is initialized, segfaulting at startup.
113+
# Override the per-target malloc attribute to use the system allocator, which
114+
# ASan intercepts cleanly.
115+
build:asan --custom_malloc=@bazel_tools//tools/cpp:malloc
111116

112117
# Flags with enough debug symbols to get useful outputs with Linux `perf`
113118
build:profile --strip=never

0 commit comments

Comments
 (0)