[lld] [lld][WebAssembly] Add `GOT.mem` for `WASM_MEMORY_ADDR_REL_` of Shared Data (PR #104920)

Luc Blaeser via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 21 00:19:05 PDT 2024


luc-blaeser wrote:

> The way this stuff is designed to work is that a given symbol is either accessed via the GOT _or_ via base register.
> 
> If you are accessing something via `__memory_base` or via `__table_base` then the result is a fixed offset from a dynamic location.
> 
> If you are accessing something via a GOT entry then each symbol gets its own global (no offset needed).

Thank you for the explanation. I was primarily wondering about the case an importing module would need to perform pointer comparison or arithmetics on that exported data. But maybe this would need explicit GOT entry from the LLVM codegen? I am happy to close this PR if not needed. 

https://github.com/llvm/llvm-project/pull/104920


More information about the llvm-commits mailing list