[PATCH] D145626: [WebAssembly] Support debug info for TLS + global in PIC mode
Heejin Ahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 8 16:17:00 PST 2023
aheejin created this revision.
aheejin added reviewers: dschuff, sbc100.
Herald added subscribers: pmatos, asb, wingo, ecnelises, sunfish, hiraditya, jgravelle-google.
Herald added a project: All.
aheejin requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This adds debug info support for
- `thread_local` global variables, both in non-PIC and PIC modes
- (non-thread_local) Global variables in PIC mode
The former needs to read the value from an offset relative to
`__tls_base` and the latter an offset from `__memory_base`. The code for
doing this overlaps with some of the existing code to add
`__stack_pointer` global, so this adds a new member function to add a
a global in `TI_GLOBAL_RELOC` mode and use it in all three places.
Split DWARF support is currently patchy at best, because the index for
`__tls_base` is not fixed after dynamic linking. The preexisting split
DWARF support for `__stack_pointer` relies on that in practice it is
always index 0. This does similar hardcoding for `__tls_base` and
`__memory_base`, but `__tls_base`'s index in dynamic linking is not
fixed now (See
https://github.com/llvm/llvm-project/blob/19afbfe33156d211fa959dadeea46cd17b9c723c/lld/wasm/Driver.cpp#L786-L823
for details), TLS + dynamic linking will not work at the moment.
This also doesn't add split DWARF tests yet, which I plan to do as a
follow-up, but as I said, it wouldn't work in all cases for now.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D145626
Files:
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
llvm/test/DebugInfo/WebAssembly/tls_pic_globals.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145626.503552.patch
Type: text/x-patch
Size: 15027 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230309/52c0e6b2/attachment.bin>
More information about the llvm-commits
mailing list