[WebAssembly] Support debug info for TLS + global in PIC mode
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. Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=1416702. Reviewed By: dschuff Differential Revision: https://reviews.llvm.org/D145626
Loading
Please sign in to comment