File: mutable-global-exports.s

package info (click to toggle)
llvm-toolchain-17 1%3A17.0.6-22
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,799,624 kB
  • sloc: cpp: 6,428,607; ansic: 1,383,196; asm: 793,408; python: 223,504; objc: 75,364; f90: 60,502; lisp: 33,869; pascal: 15,282; sh: 9,684; perl: 7,453; ml: 4,937; awk: 3,523; makefile: 2,889; javascript: 2,149; xml: 888; fortran: 619; cs: 573
file content (113 lines) | stat: -rw-r--r-- 4,644 bytes parent folder | download | duplicates (16)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s
#
# Should fail without mutable globals feature enabled.
# RUN: not wasm-ld --export-all %t.o -o %t.wasm 2>&1 | FileCheck -check-prefix=CHECK-ERR %s
# RUN: not wasm-ld --export=foo_global %t.o -o %t.wasm 2>&1 | FileCheck -check-prefix=CHECK-ERR %s

# RUN: wasm-ld --extra-features=mutable-globals --export=foo_global %t.o -o %t.wasm
# RUN: obj2yaml %t.wasm | FileCheck %s

# Explcitly check that __stack_pointer can be exported
# RUN: wasm-ld --extra-features=mutable-globals --export=__stack_pointer %t.o -o %t.wasm
# RUN: obj2yaml %t.wasm | FileCheck -check-prefix=CHECK-SP %s

# RUN: wasm-ld --extra-features=mutable-globals --export-all %t.o -o %t.wasm
# RUN: obj2yaml %t.wasm | FileCheck -check-prefix=CHECK-ALL %s

.globl _start
.globl foo_global

.globaltype foo_global, i32
foo_global:

_start:
  .functype _start () -> ()
  end_function

# Add a target feature and ensure that it is preserved when --extra-features is
# used above.
.section  .custom_section.target_features,"",@
  .int8 1
  .int8 43
  .int8 7
  .ascii  "atomics"

# CHECK-ERR: mutable global exported but 'mutable-globals' feature not present in inputs: `foo_global`. Use --no-check-features to suppress

#      CHECK:  - Type:            EXPORT
# CHECK-NEXT:    Exports:
# CHECK-NEXT:      - Name:            memory
# CHECK-NEXT:        Kind:            MEMORY
# CHECK-NEXT:        Index:           0
# CHECK-NEXT:      - Name:            _start
# CHECK-NEXT:        Kind:            FUNCTION
# CHECK-NEXT:        Index:           0
# CHECK-NEXT:      - Name:            foo_global
# CHECK-NEXT:        Kind:            GLOBAL
# CHECK-NEXT:        Index:           1
# CHECK-NEXT:  - Type:            CODE

#      CHECK-SP:  - Type:            EXPORT
# CHECK-SP-NEXT:    Exports:
# CHECK-SP-NEXT:      - Name:            memory
# CHECK-SP-NEXT:        Kind:            MEMORY
# CHECK-SP-NEXT:        Index:           0
# CHECK-SP-NEXT:      - Name:            __stack_pointer
# CHECK-SP-NEXT:        Kind:            GLOBAL
# CHECK-SP-NEXT:        Index:           0
# CHECK-SP-NEXT:      - Name:            _start
# CHECK-SP-NEXT:        Kind:            FUNCTION
# CHECK-SP-NEXT:        Index:           0
# CHECK-SP-NEXT:  - Type:            CODE

#      CHECK-ALL:  - Type:            EXPORT
# CHECK-ALL-NEXT:    Exports:
# CHECK-ALL-NEXT:      - Name:            memory
# CHECK-ALL-NEXT:        Kind:            MEMORY
# CHECK-ALL-NEXT:        Index:           0
# CHECK-ALL-NEXT:      - Name:            __wasm_call_ctors
# CHECK-ALL-NEXT:        Kind:            FUNCTION
# CHECK-ALL-NEXT:        Index:           0
# CHECK-ALL-NEXT:      - Name:            _start
# CHECK-ALL-NEXT:        Kind:            FUNCTION
# CHECK-ALL-NEXT:        Index:           1
# CHECK-ALL-NEXT:      - Name:            foo_global
# CHECK-ALL-NEXT:        Kind:            GLOBAL
# CHECK-ALL-NEXT:        Index:           1
# CHECK-ALL-NEXT:      - Name:            __dso_handle
# CHECK-ALL-NEXT:        Kind:            GLOBAL
# CHECK-ALL-NEXT:        Index:           2
# CHECK-ALL-NEXT:      - Name:            __data_end
# CHECK-ALL-NEXT:        Kind:            GLOBAL
# CHECK-ALL-NEXT:        Index:           3
# CHECK-ALL-NEXT:      - Name:            __stack_low
# CHECK-ALL-NEXT:        Kind:            GLOBAL
# CHECK-ALL-NEXT:        Index:           4
# CHECK-ALL-NEXT:      - Name:            __stack_high
# CHECK-ALL-NEXT:        Kind:            GLOBAL
# CHECK-ALL-NEXT:        Index:           5
# CHECK-ALL-NEXT:      - Name:            __global_base
# CHECK-ALL-NEXT:        Kind:            GLOBAL
# CHECK-ALL-NEXT:        Index:           6
# CHECK-ALL-NEXT:      - Name:            __heap_base
# CHECK-ALL-NEXT:        Kind:            GLOBAL
# CHECK-ALL-NEXT:        Index:           7
# CHECK-ALL-NEXT:      - Name:            __heap_end
# CHECK-ALL-NEXT:        Kind:            GLOBAL
# CHECK-ALL-NEXT:        Index:           8
# CHECK-ALL-NEXT:      - Name:            __memory_base
# CHECK-ALL-NEXT:        Kind:            GLOBAL
# CHECK-ALL-NEXT:        Index:           9
# CHECK-ALL-NEXT:      - Name:            __table_base
# CHECK-ALL-NEXT:        Kind:            GLOBAL
# CHECK-ALL-NEXT:        Index:           10
# CHECK-ALL-NEXT:  - Type:            CODE

# CHECK-ALL:         Name:            target_features
# CHECK-ALL-NEXT:    Features:
# CHECK-ALL-NEXT:      - Prefix:          USED
# CHECK-ALL-NEXT:        Name:            atomics
# CHECK-ALL-NEXT:      - Prefix:          USED
# CHECK-ALL-NEXT:        Name:            mutable-globals
# CHECK-ALL-NEXT: ...