-
Notifications
You must be signed in to change notification settings - Fork 16.9k
Expand file tree
/
Copy paththread-context-abi-mismatch.s
More file actions
48 lines (37 loc) · 1.6 KB
/
thread-context-abi-mismatch.s
File metadata and controls
48 lines (37 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Test that linking object files with mismatched thread context ABIs fails with an error.
# RUN: split-file %s %t
# Test that the presence of an import of __stack_pointer from the env module is treated
# as an indication that the global thread context ABI is being used, even if the
# libcall-thread-context feature is not disallowed.
# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t/start.o %t/start.s
# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t/stack-pointer.o %t/stack-pointer.s
# RUN: not wasm-ld --libcall-thread-context %t/start.o %t/stack-pointer.o -o %t/fail.wasm 2>&1 | FileCheck %s
# Test that explicitly disallowing the libcall-thread-context feature causes linking to fail
# with an error when other files use the feature.
# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t/disallow.o %t/disallow.s
# RUN: not wasm-ld --libcall-thread-context %t/start.o %t/disallow.o -o %t/fail.wasm 2>&1 | FileCheck %s
# CHECK: error: --libcall-thread-context is disallowed by {{.*}} because it uses globals for thread context rather than library function calls.
#--- start.s
.globl _start
_start:
.functype _start () -> ()
end_function
.section .custom_section.target_features,"",@
.int8 1
.int8 43
.int8 22
.ascii "libcall-thread-context"
#--- stack-pointer.s
.globaltype __stack_pointer, i32
.globl use_stack_pointer
use_stack_pointer:
.functype use_stack_pointer () -> ()
global.get __stack_pointer
drop
end_function
#--- disallow.s
.section .custom_section.target_features,"",@
.int8 1
.int8 45
.int8 22
.ascii "libcall-thread-context"