1; RUN: llc -filetype=obj %s -o %t.o
2; RUN: wasm-ld --allow-undefined -o %t.wasm %t.o
3
4; Fails due to undefined 'foo'
5; RUN: not wasm-ld --undefined=baz -o %t.wasm %t.o 2>&1 | FileCheck %s
6; CHECK: error: {{.*}}.o: undefined symbol: foo
7; CHECK-NOT: undefined symbol: baz
8
9; Succeeds if we pass a file containing 'foo' as --allow-undefined-file.
10; RUN: echo 'foo' > %t.txt
11; RUN: wasm-ld --allow-undefined-file=%t.txt -o %t.wasm %t.o
12
13; Succeeds even if a missing symbol is added via --export
14; RUN: wasm-ld --allow-undefined --export=xxx -o %t.wasm %t.o
15
16target triple = "wasm32-unknown-unknown"
17
18; Takes the address of the external foo() resulting in undefined external
19@bar = global i8* bitcast (i32 ()* @foo to i8*), align 4
20@llvm.used = appending global [1 x i8**] [i8** @bar], section "llvm.metadata"
21
22declare i32 @foo() #0
23
24define hidden void @_start() local_unnamed_addr #0 {
25entry:
26    ret void
27}
28