Skip to content

Commit 0db7e18

Browse files
committed
bazel: compress DWARF debug sections in asan/profile configs
The default bazel build is -c opt with no -g, so it carries no debug info. The asan and profile configs add -g (and keep symbols via --strip=never), so their binaries carry DWARF that benefits from compression, mirroring the CMake -gz change. Add -gz=zlib (compile + link) to the asan and profile configs. It is transparent to gdb/perf/addr2line. Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
1 parent 78f043d commit 0db7e18

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

.bazelrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ build:asan --copt=-DADDRESS_SANITIZER
111111
build:asan --copt=-O1
112112
build:asan --copt=-g
113113
build:asan --copt=-fno-omit-frame-pointer
114+
# Compress the DWARF debug sections (transparent to gdb/perf/addr2line).
115+
build:asan --copt=-gz=zlib
116+
build:asan --linkopt=-gz=zlib
114117
build:asan --linkopt=-fsanitize=address
115118
# TCMalloc is incompatible with ASan: __asan_init's interceptor setup calls
116119
# dlsym -> malloc before TCMalloc is initialized, segfaulting at startup.
@@ -123,6 +126,9 @@ build:profile --strip=never
123126
build:profile --copt -g --host_copt -g
124127
build:profile --copt -gmlt --host_copt -gmlt
125128
build:profile --copt -fno-omit-frame-pointer --host_copt -fno-omit-frame-pointer
129+
# Compress the DWARF debug sections (transparent to gdb/perf/addr2line).
130+
build:profile --copt=-gz=zlib --host_copt=-gz=zlib
131+
build:profile --linkopt=-gz=zlib
126132

127133
# Improve hermeticity by disallowing user envars and network access
128134
build --incompatible_strict_action_env

0 commit comments

Comments
 (0)