I 'm trying to figure out why LLVM emits broken DWARF debug info on Windows. When I load executable in gdb it says “DW_FORM_strp pointing outside of .debug_str section [in module … ]” It looks like this issue had been previously reported here , . I am still seeing this error with clang compiled from master branch (as well as in 3.3 and 3.2).
So I compared asm emitted by clang with that created by gcc, and the difference seems to be that for inter-debug-section references gcc uses .secrel32 directive, whereas clang uses .long . After manually replacing .long’s with .secrel32’s and building executable, gdb seemed to like new debug info a lot more!
I am not sure what’s the right approach for fixing this. Should .secrel32 be used on all platforms, or just for Windows PE-COFF? Can somebody familiar with intricacies of DWARF format on different platforms please comment of this?