[lld] [lld][WebAssembly] Fix relocation of Wasm table index with GOT access (PR #104043)

Luc Blaeser via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 20 02:07:13 PDT 2024


================
@@ -0,0 +1,27 @@
+# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s
+
+# RUN: not wasm-ld --experimental-pic -shared %t.o -o /dev/null 2>&1 | \
+# RUN:   FileCheck -check-prefix=ERRUND %s
+# ERRUND: error: {{.*}}.o: relocation R_WASM_TABLE_INDEX_REL_SLEB cannot be used against an undefined symbol `external_func`
+
+# RUN: not wasm-ld --experimental-pic -shared %t.o -o /dev/null  --unresolved-symbols=report-all 2>&1 | \
+# RUN:   FileCheck -check-prefix=ERRUND %s
+
+# RUN: not wasm-ld --experimental-pic -shared %t.o -o /dev/null  --warn-unresolved-symbols 2>&1 | \
+# RUN:   FileCheck -check-prefix=ERRUND %s
+
+# RUN: not wasm-ld --experimental-pic -shared %t.o -o /dev/null  --unresolved-symbols=ignore-all 2>&1 | \
+# RUN:   FileCheck -check-prefix=ERRUND %s
+
+.globaltype	__table_base, i32, immutable
+
+.functype external_func () -> ()
+
+.globl _start
+_start:
+    .functype _start () -> ()
+    global.get  __table_base
+    i32.const external_func at TBREL
----------------
luc-blaeser wrote:

Thank you! I improved this.

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


More information about the llvm-commits mailing list