[lld] [llvm] [WebAssembly] Use 64-bit table when targeting wasm64 (PR #92042)

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Wed May 15 15:31:05 PDT 2024


================
@@ -584,12 +584,10 @@ void ElemSection::writeBody() {
   initExpr.Extended = false;
   if (ctx.isPic) {
     initExpr.Inst.Opcode = WASM_OPCODE_GLOBAL_GET;
-    initExpr.Inst.Value.Global =
-        (config->is64.value_or(false) ? WasmSym::tableBase32
-                                      : WasmSym::tableBase)
-            ->getGlobalIndex();
----------------
sbc100 wrote:

Because we the table is now 64-bit or 32-bit according to whether wasm64 is in use, it now always matches the type of the `__table_base` global.  Prior to this we couldn't use `__table_base` in the case of wasm64 because `__table_base` is 64-bit but the table was only 32-bit, so we needed to use `__tabe_base32`.

This is another advantage to using table64. 

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


More information about the llvm-commits mailing list