2018-01-24 11:29:47 +08:00
|
|
|
; RUN: llc -filetype=obj %s -o %t.o
|
2018-05-05 09:23:07 +08:00
|
|
|
; RUN: wasm-ld --allow-undefined -o %t.wasm %t.o
|
2017-11-18 02:14:09 +08:00
|
|
|
|
2019-07-10 04:45:20 +08:00
|
|
|
; Fails due to undefined 'foo'
|
2018-05-05 09:23:07 +08:00
|
|
|
; RUN: not wasm-ld --undefined=baz -o %t.wasm %t.o 2>&1 | FileCheck %s
|
2017-11-18 02:14:09 +08:00
|
|
|
; CHECK: error: {{.*}}.o: undefined symbol: foo
|
2018-08-04 08:04:06 +08:00
|
|
|
; CHECK-NOT: undefined symbol: baz
|
2017-11-18 02:14:09 +08:00
|
|
|
|
2018-03-08 09:16:05 +08:00
|
|
|
; Succeeds if we pass a file containing 'foo' as --allow-undefined-file.
|
2017-11-18 02:14:09 +08:00
|
|
|
; RUN: echo 'foo' > %t.txt
|
2018-05-05 09:23:07 +08:00
|
|
|
; RUN: wasm-ld --allow-undefined-file=%t.txt -o %t.wasm %t.o
|
2017-11-18 02:14:09 +08:00
|
|
|
|
2018-03-08 09:16:05 +08:00
|
|
|
; Succeeds even if a missing symbol is added via --export
|
2018-05-05 09:23:07 +08:00
|
|
|
; RUN: wasm-ld --allow-undefined --export=xxx -o %t.wasm %t.o
|
2018-03-08 09:16:05 +08:00
|
|
|
|
2018-05-11 01:59:41 +08:00
|
|
|
target triple = "wasm32-unknown-unknown"
|
2018-01-24 11:29:47 +08:00
|
|
|
|
2017-11-18 02:14:09 +08:00
|
|
|
; Takes the address of the external foo() resulting in undefined external
|
2019-07-10 04:45:20 +08:00
|
|
|
@bar = global i8* bitcast (i32 ()* @foo to i8*), align 4
|
|
|
|
@llvm.used = appending global [1 x i8**] [i8** @bar], section "llvm.metadata"
|
2017-11-18 02:14:09 +08:00
|
|
|
|
|
|
|
declare i32 @foo() #0
|
|
|
|
|
|
|
|
define hidden void @_start() local_unnamed_addr #0 {
|
|
|
|
entry:
|
|
|
|
ret void
|
|
|
|
}
|