[llvm-dev] Query regarding relocatable stuff in DWO.

Sourabh Singh Tomar via llvm-dev llvm-dev at lists.llvm.org
Sun Dec 22 05:40:45 PST 2019


Hello Everyone,

Consider this asm snippet for a moment --

section .debug_info.dwo
...
.long   .Ldebug_macinfo0        # DW_AT_macros
...

.section        .debug_macinfo.dwo,"e", at progbits
 .Ldebug_macinfo0:
     .byte   0x1     # Define macro
....
When compiling this with clang, produces
fatal error: error in backend: A dwo section may not contain relocations --
seems fair,
Since we don't want relocations in DWO file. Please note here GCC{trunk}
has no problem with this /Okay with relocations in DWO/ Why??

Now the real problem -- Since DW_AT_macros/macinfo can appear in both
split/non-split case.{Only in one or another}. Pointing to macro/macro.dwo
section.
Now clang won't allow me to use above approach. So only option left to
avoid relocations, emitting DW_AT_macros attribute as a difference of
labels.
i.e
.long   .Lcu_macro_begin1-.debug_macro.dwo       # DW_AT_macro_info

This worked great, clang is fine, GDB also happy. But that was manual
assembly hack I opted. I didn't find any API in /MCStreamer/ that can
provide me a difference of 2 labels as label.
This is needed here --
TheCU.addSectionLabel(TheCU.getUnitDie(),dwarf::DW_AT_macros,
              /*Label here?*/,
TLOF.getDwarfMacroDWOSection()->getBeginSymbol()); -- requires a label to
add in.
Theirs analogous EmitLabelDifference(Sym, Sym, Size) API -- but that's for
emitting + return type is void, So can't plug it in in here.

Any hints, how to overcome this ?

Thanks in anticipation!
Sourabh.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191222/3ee7e2c2/attachment.html>


More information about the llvm-dev mailing list