This is a new mode for handling unresolved symbols that allows all symbols to be imported in the same that they would be in the case of `-fpie` or `-shared`, but generting an otherwise fixed/non-relocatable binary. Code linked in this way should still be compiled with `-fPIC` so that data symbols can be resolved via imports. This essentially allows the building of static binaries that have dynamic imports. See: https://github.com/emscripten-core/emscripten/issues/12682 As with other uses of the experimental dynamic linking ABI, this behaviour will produce a warning unless run with `--experimental-pic`. Differential Revision: https://reviews.llvm.org/D91577
17 lines
642 B
ArmAsm
17 lines
642 B
ArmAsm
# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s
|
|
# RUN: not wasm-ld -o %t.wasm %t.o 2>&1 | FileCheck %s -check-prefix=UNDEF
|
|
# RUN: wasm-ld --allow-undefined -o %t.wasm %t.o
|
|
# RUN: not wasm-ld --shared -o %t.wasm %t.o 2>&1 | FileCheck %s -check-prefix=SHARED
|
|
|
|
.globl _start
|
|
_start:
|
|
.functype _start () -> (i32)
|
|
i32.const 0
|
|
i32.load data_external
|
|
end_function
|
|
|
|
.size data_external, 4
|
|
|
|
# UNDEF: error: {{.*}}undefined-data.s.tmp.o: undefined symbol: data_external
|
|
# SHARED: error: {{.*}}undefined-data.s.tmp.o: relocation R_WASM_MEMORY_ADDR_LEB cannot be used against symbol `data_external`; recompile with -fPIC
|