
Previously we would ignore all undefined symbols when using `-shared` or `-pie`. All undefined symbols would be treated as imports regardless of whether those symbols we defined in any shared library. With this change we now track symbol in shared libraries and report undefined symbols in the main program by default. The old behavior is still available via the `--unresolved-symbols=import-dynamic` command line flag. This rationale for allowing this type of breaking change is that `-pie` and `-shared` are both still experimental will warn as such, unless `--experimental-pic` is passed. As part of this change the linker now models shared library symbols via new SharedFunctionSymbol and SharedDataSymbol types. I've also added a new `--no-shlib-sigcheck` option that bypassed the checking of functions signature in shared libraries. This is specifically required by emscripten the case where the imports/exports of shared libraries have been modified by via JS type legalization (this is only needed when targeting old JS engines where bigint is not yet available See https://github.com/emscripten-core/emscripten/issues/18198
40 lines
1.4 KiB
ArmAsm
40 lines
1.4 KiB
ArmAsm
# 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: wasm-ld --experimental-pic -shared %t.ret32.o -o %t.lib.so
|
|
|
|
## Fails with signature mismatch by default
|
|
# RUN: not wasm-ld --experimental-pic -pie -o %t.wasm %t.o %t.lib.so 2>&1 | FileCheck --check-prefix=ERROR %s
|
|
## Same again with shared library first.
|
|
# RUN: not wasm-ld --experimental-pic -pie -o %t.wasm %t.lib.so %t.o 2>&1 | FileCheck --check-prefix=ERROR %s
|
|
|
|
## Succeeds with --no-shlib-sigcheck added
|
|
# RUN: wasm-ld --experimental-pic -pie -o %t.wasm %t.o %t.lib.so --no-shlib-sigcheck
|
|
# RUN: obj2yaml %t.wasm | FileCheck %s
|
|
## Same again with shared library first.
|
|
# RUN: wasm-ld --experimental-pic -pie -o %t.wasm %t.lib.so %t.o --no-shlib-sigcheck
|
|
# RUN: obj2yaml %t.wasm | FileCheck %s
|
|
|
|
.functype ret32 (f32) -> (i64)
|
|
|
|
.globl _start
|
|
_start:
|
|
.functype _start () -> ()
|
|
f32.const 0.0
|
|
call ret32
|
|
drop
|
|
end_function
|
|
|
|
# ERROR: wasm-ld: error: function signature mismatch: ret32
|
|
# ERROR: >>> defined as (f32) -> i64 in {{.*}}.o
|
|
|
|
# CHECK: - Type: TYPE
|
|
# CHECK-NEXT: Signatures:
|
|
# CHECK-NEXT: - Index: 0
|
|
# CHECK-NEXT: ParamTypes:
|
|
# CHECK-NEXT: - F32
|
|
# CHECK-NEXT: ReturnTypes:
|
|
# CHECK-NEXT: - I64
|
|
# CHECK-NEXT: - Index: 1
|
|
# CHECK-NEXT: ParamTypes: []
|
|
# CHECK-NEXT: ReturnTypes: []
|