This was originally the way this worked before before https://reviews.llvm.org/D60882. In retrospect it seems inconsistent that `--allow-undefined` doesn't work for all symbols. See: https://groups.google.com/g/emscripten-discuss/c/HSRgQiIq1gI/m/Kt9oFWHiAwAJ I'm also planning a followup change which implement the full `--unresolved-symbols=..` flags supported by ELF linkers (both ld and ld.lld) since it seems more standard. Differential Revision: https://reviews.llvm.org/D79247
18 lines
649 B
LLVM
18 lines
649 B
LLVM
; RUN: llc -filetype=obj %s -o %t.o
|
|
; 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
|
|
|
|
target triple = "wasm32-unknown-unknown"
|
|
|
|
@data_external = external global i32
|
|
|
|
define i32 @_start() {
|
|
entry:
|
|
%0 = load i32, i32* @data_external, align 4
|
|
ret i32 %0
|
|
}
|
|
|
|
; UNDEF: error: {{.*}}undefined-data.ll.tmp.o: undefined symbol: data_external
|
|
; SHARED: error: {{.*}}undefined-data.ll.tmp.o: relocation R_WASM_MEMORY_ADDR_LEB cannot be used against symbol data_external; recompile with -fPIC
|