llvm-project
27 строк · 1.2 Кб
1; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/ret32.s -o %t.ret32.o
2; RUN: llc -filetype=obj %s -o %t.main.o
3; RUN: wasm-ld --fatal-warnings -o %t.wasm %t.ret32.o %t.main.o
4; RUN: wasm-ld --fatal-warnings -o %t.wasm %t.main.o %t.ret32.o
5
6; Also test the case where there are two different object files that contains
7; references ret32:
8; %t.main.o: Does not call ret32 directly; used the wrong signature.
9; %t.call-ret32.o: Calls ret32 directly; uses the correct signature.
10; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/call-ret32.s -o %t.call-ret32.o
11; RUN: wasm-ld --export=call_ret32 --fatal-warnings -o %t.wasm %t.main.o %t.call-ret32.o %t.ret32.o
12; RUN: wasm-ld --export=call_ret32 --fatal-warnings -o %t.wasm %t.call-ret32.o %t.main.o %t.ret32.o
13
14target triple = "wasm32-unknown-unknown"
15
16; Function declaration with incorrect signature.
17declare dso_local void @ret32()
18
19; Simply taking the address of the function should *not* generate the
20; the signature mismatch warning.
21@ptr = dso_local global ptr @ret32, align 8
22
23define hidden void @_start() local_unnamed_addr {
24%addr = load ptr, ptr @ptr, align 8
25call i32 %addr()
26ret void
27}
28