llvm-project

Форк
0
/
multi-table.s 
152 строки · 6.3 Кб
1
# RUN: not llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.a1.o %s 2>&1 | FileCheck %s --check-prefix=MVP
2
# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -mattr=+reference-types -o %t.a1.rt.o %s
3
# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/call-indirect.s -o %t.a2.o
4
# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -mattr=+reference-types %p/Inputs/call-indirect.s -o %t.a2.rt.o
5
# RUN: not wasm-ld --allow-undefined --export-dynamic --no-entry -o %t.wasm %t.a1.rt.o %t.a2.o 2>&1 | FileCheck %s --check-prefix=RT-MVP
6
# RUN: wasm-ld --allow-undefined --export-dynamic --no-entry -o- %t.a1.rt.o %t.a2.rt.o | obj2yaml | FileCheck %s
7

8
  .globl  table_a
9
  .tabletype table_a, funcref
10

11
  .globl  table_b
12
table_b:
13
  .tabletype table_b, funcref
14

15
  .globl  table_c
16
table_c:
17
  .tabletype table_c, externref
18

19
  .globl  call_indirect_explicit_tables
20
call_indirect_explicit_tables:
21
  .functype call_indirect_explicit_tables () -> ()
22
  i32.const 0
23
  call_indirect table_a, () -> ()
24
# MVP: error: Expected (, instead got: table_a
25
  i32.const 0
26
  call_indirect table_b, () -> ()
27
  end_function
28

29
# RT-MVP: wasm-ld: error: object file not built with 'reference-types' feature conflicts with import of table table_a by file
30

31
# CHECK:      --- !WASM
32
# CHECK-NEXT: FileHeader:
33
# CHECK-NEXT:   Version:         0x1
34
# CHECK-NEXT: Sections:
35
# CHECK-NEXT:   - Type:            TYPE
36
# CHECK-NEXT:     Signatures:
37
# CHECK-NEXT:       - Index:           0
38
# CHECK-NEXT:         ParamTypes:      []
39
# CHECK-NEXT:         ReturnTypes:     []
40
# CHECK-NEXT:       - Index:           1
41
# CHECK-NEXT:         ParamTypes:      []
42
# CHECK-NEXT:         ReturnTypes:
43
# CHECK-NEXT:           - I64
44
# CHECK-NEXT:       - Index:           2
45
# CHECK-NEXT:         ParamTypes:      []
46
# CHECK-NEXT:         ReturnTypes:
47
# CHECK-NEXT:           - I32
48
# CHECK-NEXT:   - Type:            IMPORT
49
# CHECK-NEXT:     Imports:
50
# CHECK-NEXT:       - Module:          env
51
# CHECK-NEXT:         Field:           table_a
52
# CHECK-NEXT:         Kind:            TABLE
53
# CHECK-NEXT:         Table:
54
# CHECK-NEXT:           Index:           0
55
# CHECK-NEXT:           ElemType:        FUNCREF
56
# CHECK-NEXT:           Limits:
57
# CHECK-NEXT:             Minimum:         0x0
58
# CHECK-NEXT:       - Module:          env
59
# CHECK-NEXT:         Field:           foo
60
# CHECK-NEXT:         Kind:            FUNCTION
61
# CHECK-NEXT:         SigIndex:        2
62
# CHECK-NEXT:   - Type:            FUNCTION
63
# CHECK-NEXT:     FunctionTypes:   [ 0, 1, 0 ]
64
# CHECK-NEXT:   - Type:            TABLE
65
# CHECK-NEXT:     Tables:
66
# CHECK-NEXT:       - Index:           1
67
# CHECK-NEXT:         ElemType:        FUNCREF
68
# CHECK-NEXT:         Limits:
69
# CHECK-NEXT:           Minimum:         0x0
70
# CHECK-NEXT:       - Index:           2
71
# CHECK-NEXT:         ElemType:        EXTERNREF
72
# CHECK-NEXT:         Limits:
73
# CHECK-NEXT:           Minimum:         0x0
74
# CHECK-NEXT:       - Index:           3
75
# CHECK-NEXT:         ElemType:        FUNCREF
76
# CHECK-NEXT:         Limits:
77
# CHECK-NEXT:           Flags:           [ HAS_MAX ]
78
# CHECK-NEXT:           Minimum:         0x3
79
# CHECK-NEXT:           Maximum:         0x3
80
# CHECK-NEXT:   - Type:            MEMORY
81
# CHECK-NEXT:     Memories:
82
# CHECK-NEXT:       - Minimum:         0x2
83
# CHECK-NEXT:   - Type:            GLOBAL
84
# CHECK-NEXT:     Globals:
85
# CHECK-NEXT:       - Index:           0
86
# CHECK-NEXT:         Type:            I32
87
# CHECK-NEXT:         Mutable:         true
88
# CHECK-NEXT:         InitExpr:
89
# CHECK-NEXT:           Opcode:          I32_CONST
90
# CHECK-NEXT:           Value:           66576
91
# CHECK-NEXT:   - Type:            EXPORT
92
# CHECK-NEXT:     Exports:
93
# CHECK-NEXT:       - Name:            memory
94
# CHECK-NEXT:         Kind:            MEMORY
95
# CHECK-NEXT:         Index:           0
96
# CHECK-NEXT:       - Name:            table_b
97
# CHECK-NEXT:         Kind:            TABLE
98
# CHECK-NEXT:         Index:           1
99
# CHECK-NEXT:       - Name:            table_c
100
# CHECK-NEXT:         Kind:            TABLE
101
# CHECK-NEXT:         Index:           2
102
# CHECK-NEXT:       - Name:            call_indirect_explicit_tables
103
# CHECK-NEXT:         Kind:            FUNCTION
104
# CHECK-NEXT:         Index:           1
105
# CHECK-NEXT:       - Name:            bar
106
# CHECK-NEXT:         Kind:            FUNCTION
107
# CHECK-NEXT:         Index:           2
108
# CHECK-NEXT:       - Name:            call_bar_indirect
109
# CHECK-NEXT:         Kind:            FUNCTION
110
# CHECK-NEXT:         Index:           3
111
# CHECK-NEXT:   - Type:            ELEM
112
# CHECK-NEXT:     Segments:
113
# CHECK-NEXT:       - Flags:           2
114
# CHECK-NEXT:         TableNumber:     3
115
# CHECK-NEXT:         ElemKind:        FUNCREF
116
# CHECK-NEXT:         Offset:
117
# CHECK-NEXT:           Opcode:          I32_CONST
118
# CHECK-NEXT:           Value:           1
119
# CHECK-NEXT:         Functions:       [ 2, 0 ]
120
# CHECK-NEXT:   - Type:            CODE
121
# CHECK-NEXT:     Functions:
122
# CHECK-NEXT:       - Index:           1
123
# CHECK-NEXT:         Locals:          []
124
# CHECK-NEXT:         Body:            41001180808080008080808000410011808080800081808080000B
125
# CHECK-NEXT:       - Index:           2
126
# CHECK-NEXT:         Locals:          []
127
# CHECK-NEXT:         Body:            42010B
128
# CHECK-NEXT:       - Index:           3
129
# CHECK-NEXT:         Locals:          []
130
# CHECK-NEXT:         Body:            41002802808880800011818080800083808080001A41002802848880800011828080800083808080001A0B
131
# CHECK-NEXT:   - Type:            DATA
132
# CHECK-NEXT:     Segments:
133
# CHECK-NEXT:       - SectionOffset:   7
134
# CHECK-NEXT:         InitFlags:       0
135
# CHECK-NEXT:         Offset:
136
# CHECK-NEXT:           Opcode:          I32_CONST
137
# CHECK-NEXT:           Value:           1024
138
# CHECK-NEXT:         Content:         '0100000002000000'
139
# CHECK-NEXT:   - Type:            CUSTOM
140
# CHECK-NEXT:     Name:            name
141
# CHECK-NEXT:     FunctionNames:
142
# CHECK-NEXT:       - Index:           0
143
# CHECK-NEXT:         Name:            foo
144
# CHECK-NEXT:       - Index:           1
145
# CHECK-NEXT:         Name:            call_indirect_explicit_tables
146
# CHECK-NEXT:       - Index:           2
147
# CHECK-NEXT:         Name:            bar
148
# CHECK-NEXT:       - Index:           3
149
# CHECK-NEXT:         Name:            call_bar_indirect
150
# CHECK-NEXT:     GlobalNames:
151
# CHECK-NEXT:       - Index:           0
152
# CHECK-NEXT:         Name:            __stack_pointer
153

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.