We can't (currently) meaningfully resolve certain types of relocations against undefined data symbols. Previously when `--allow-undefined` was used we were treating such relocation much like weak data symbols and simply inserting zeros. This change turns such use cases in to an error. This means that `--allow-undefined` is no longer effective for data symbols. Fixes https://bugs.llvm.org/show_bug.cgi?id=40364 Differential Revision: https://reviews.llvm.org/D60882 llvm-svn: 358899
19 lines
788 B
LLVM
19 lines
788 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: not wasm-ld --allow-undefined -o %t.wasm %t.o 2>&1 | FileCheck %s -check-prefix=ALLOW
|
|
; 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: undefined symbol: data_external
|
|
; ALLOW: undefined-data.ll.tmp.o: cannot resolve relocation of type R_WASM_MEMORY_ADDR_LEB against undefined (non-weak) data symbol: data_external
|
|
; SHARED: undefined-data.ll.tmp.o: relocation R_WASM_MEMORY_ADDR_LEB cannot be used againt symbol data_external; recompile with -fPIC
|