[lld] [lld][WebAssembly] Report undefined symbols by default -shared/-pie builds (PR #75242)

Derek Schuff via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 21 10:55:25 PST 2023


================
@@ -0,0 +1,30 @@
+# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-emscripten -o %t.o %s
+# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-emscripten %p/Inputs/ret32.s -o %t.ret32.o
+# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-emscripten %p/Inputs/libsearch-dyn.s -o %t.dyn.o
+# RUN: wasm-ld --experimental-pic -shared %t.ret32.o %t.dyn.o -o %t.lib.so
+# RUN: not wasm-ld --experimental-pic -pie -o %t.wasm %t.o 2>&1 | FileCheck --check-prefix=ERROR %s
+# RUN: wasm-ld --experimental-pic -pie -o %t.wasm %t.o %t.lib.so
+# RUN: obj2yaml %t.wasm | FileCheck %s
+
+# ERROR: error: {{.*}}: undefined symbol: ret32
+.functype ret32 (f32) -> (i32)
+
+.globl _start
+_start:
+  .functype _start () -> ()
+  f32.const 0.0
+  call ret32
+  drop
+  i32.const _dynamic at GOT
----------------
dschuff wrote:

do we have a test that checks for undefined-symbol failure for a data symbol? (would that exercise any new code paths?) If not we could add another variant here with _dynamic being undefined.

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


More information about the llvm-commits mailing list