[PATCH] D92844: [gn build] Link with -Wl,--gdb-index
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 8 07:11:57 PST 2020
thakis updated this revision to Diff 310186.
thakis added a comment.
lld only
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92844/new/
https://reviews.llvm.org/D92844
Files:
llvm/utils/gn/build/BUILD.gn
Index: llvm/utils/gn/build/BUILD.gn
===================================================================
--- llvm/utils/gn/build/BUILD.gn
+++ llvm/utils/gn/build/BUILD.gn
@@ -75,6 +75,16 @@
if (host_os != "win") {
if (is_debug) {
cflags += [ "-g" ]
+
+ # --gdb-index makes links ~15% slower, and gdb symbol reading time
+ # 15x faster (lld links in 4.4 instead of 3.9s, and gdb loads and runs
+ # it in 2s instead of in 30s). Since the GN build defaults to release
+ # builds, it's likely that people doing debug builds want to run a
+ # debugger. So this seems like the right tradeoff.
+ if (host_os != "mac" && use_lld) {
+ cflags += [ "-ggnu-pubnames" ] # PR34820
+ ldflags += [ "-Wl,--gdb-index" ]
+ }
}
if (is_optimized) {
cflags += [ "-O3" ]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92844.310186.patch
Type: text/x-patch
Size: 829 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201208/f4710502/attachment.bin>
More information about the llvm-commits
mailing list