Large applications compiled with debug information experience slow link times, possible out-of-memory conditions at link time, and slow gdb startup times. In addition, they can contribute to significant increases in storage requirements, and additional network latency when transferring files in a distributed build environment.
gold linker supports gdb-index option to solve this:
Use the gold linker's --gdb-index option (-Wl,--gdb-index when linking with gcc or g++) at link time to create the .gdb_index section that allows GDB to locate and read the .dwo files as it needs them. It is used in combination with gcc -gsplit-dwarf option to enable the generation of split DWARF at compile time.
This patch is initial implementation of feature above. At this stage it is able to generate .gdb_index section for trivial helloworld application. Most of work is already done though I think.
Testcase uses object file produced by gcc for demonstration. Contents of .gdb_index produced by gold and lld are almost fully equal (string name offsets are different, which is expected and fine I believe).
There is no many information about the feature, so next sources were used as reference:
- gold source code.
- GDB 's "Appendix J .gdb_index section format" (https://sourceware.org/gdb/onlinedocs/gdb/Index-Section-Format.html).
- DWARF Debugging Information Format (http://www.dwarfstd.org/doc/DWARF4.pdf).