[PATCH] D92844: [gn build] Link with -Wl,--gdb-index

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 14 18:00:00 PST 2020


dblaikie added a comment.

In D92844#2443293 <https://reviews.llvm.org/D92844#2443293>, @thakis wrote:

> In D92844#2442915 <https://reviews.llvm.org/D92844#2442915>, @aeubanks wrote:
>
>>>> 15% slower links seems noticeable. I'd prefer putting this behind a flag (can default to `is_debug` if you really want). I think putting all optional compiler/linker command line flags behind gn args makes sense.
>>>
>>> You're setting `is_debug=true` but you don't run the binary under gdb? If so, wy do you set `is_debug=true`? For stacks with line numbers?
>>
>> Yup
>
> Do you think we should have some mode to get `-g1` for that use case? I'd expect that to make your use case link faster than it currently does. (At least while we don't use fission, but even then it'll reduce .o file size which likely means faster build time with distributed compiles.) And then we could do the index only on `-g` not `-g1` builds.
>
> In D92844#2442982 <https://reviews.llvm.org/D92844#2442982>, @MaskRay wrote:
>
>> If `-gsplit-dwarf` is set, `-Wl,--gdb-index` makes sense.
>
> The GN build currently never sets `gsplit-dwarf` and `-Wl,--gdb-index` still seems to speed up things quite a bit.

Yep - gdb-index should still be a significant speed-up even without split-dwarf. (I think there was some discussion elsewhere (on a bug or the like), but you are enabling gnu pubnames (-ggnu-pubnames) on your compiles along with gdb-index, yeah?)

> Are you saying we should _also_ use `-gsplit-dwarf` (probably a good idea), or are you saying something else?

gdb-index doesn't need split-dwarf, but split-dwarf (at least with GDB) does need gdb-index, FWIW

If split-dwarf works for the build system (in terms of having the .dwo files available - if there's an distributed element, then that distributed system needs to be aware of the dwo files and be able to move them back - and the pathnames in the .o files need to be created in such a way that the debugger can find the dwo files after they've been moved around, etc) then, yeah, there's some benefits to be had there - smaller linker input/outputs and so some speedups.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92844/new/

https://reviews.llvm.org/D92844



More information about the llvm-commits mailing list