[clang] [lld] [llvm] [WebAssembly] Emit constant initializers for addrspace(1) globals (PR #212007)
Yuta Saito via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 13 08:55:06 PDT 2026
================
@@ -28,6 +28,7 @@ class MCSymbolWasm : public MCSymbol {
wasm::WasmSignature *Signature = nullptr;
std::optional<wasm::WasmGlobalType> GlobalType;
std::optional<wasm::WasmTableType> TableType;
+ std::optional<uint64_t> GlobalInitValue;
----------------
kateinoigakukun wrote:
Right, wasm-ld doesn't support it today, but IMO it's worth to use `MCExpr` here today for some reasons:
1. It makes the future link-time relocations on init-expr significantly straightforward. It should simplify things around GOT if we can make extended-const mandatory in the future.
2. If we adopt https://github.com/llvm/llvm-project/pull/212007#discussion_r4244815731 https://github.com/llvm/llvm-project/pull/212007#discussion_r4244815734, we can reuse existing infra to convert text format to `MCExpr`
3. Changing the representation later will require reworking almost the all things again, so better to use flexible representation from day 1 while restricting the expression to be very subset for the first land.
https://github.com/llvm/llvm-project/pull/212007
More information about the cfe-commits
mailing list