I’d like to support -gsplit-dwarf for Window COFF. Currently LLVM support -gdwarf for Windows COFF. It merges all dwarf sections and store it in object/image file. Sometime the dwarf section may be very large for big project. The final exe size may be greater than 2GB limit and can’t be run on Windows. -gsplit-dwarf may be a good solution to fix that.
Can you share more about the motivation here? PDB files already split the debug info from the executable. Are there any Windows debugging tools consuming split dwarf?
@omjavaid Would lldb running on Windows be able to make use of this?
Currently on windows platform most important usage is intra operability between MSVC and Clang. We are running windows shell tests with PDB and API tests are dwarf only but we want to change this moving forward and want to test both DWARF and PDB. We actually plan on running LLDB buildbots with PDB as default in future.
Having said that I actually dont see a harm in having split dwarf as there might be users of the LLVM GNU toolchain on windows expecting this functionality.
For some reason we need to use DWARF on Windows (e.g. we can’t get linkage name from PDB). If I use -gdwarf on our project, the final exe size is greater than 3GB which exceeds limit.
PE32+ images allow for a 64-bit address space while limiting the image size to 2 gigabytes. Other PE32+ modifications are addressed in their respective sections.
Currently, MinGW usecases primarily use DWARF indeed (although one can opt into PDB as well).
At the moment, something a little like split-dwarf can be achieved after linking, by doing this:
$ llvm-objcopy --only-keep-debug product.exe product.dbg $ llvm-objcopy --strip-all product.exe $ llvm-objcopy --add-gnu-debuglink=product.dbg product.exe
With that, LLDB manages to load the debug info from the separate
product.dbg which doesn’t have to be shipped along with the main app. But this doesn’t help with cases where the intermediate image size is too large, where proper split dwarf support would help.
Support with LTO: ⚙ D154070 [lld/COFF] Add /dwodir to enable DWARF fission with LTO