1 @a = hidden global [6 x i8] c"hello\00", align 1
2 @b = hidden global [8 x i8] c"goodbye\00", align 1
3 @c = hidden global [9 x i8] c"whatever\00", align 1
4 @d = hidden global i32 42, align 4
6 @e = private constant [9 x i8] c"constant\00", align 1
7 @f = private constant i8 43, align 4
9 ; RUN: llc --mtriple=wasm32-unknown-unknown -mattr=+bulk-memory,+atomics -filetype=obj %s -o %t.passive.o
10 ; RUN: llc --mtriple=wasm64-unknown-unknown -mattr=+bulk-memory,+atomics -filetype=obj %s -o %t.passive64.o
11 ; RUN: llc --mtriple=wasm32-unknown-unknown -filetype=obj %s -o %t.o
13 ; RUN: wasm-ld -no-gc-sections --no-entry -o %t.merged.wasm %t.o
14 ; RUN: obj2yaml %t.merged.wasm | FileCheck %s --check-prefix=MERGE
16 ; MERGE-LABEL: - Type: DATA
17 ; MERGE-NEXT: Segments:
18 ; MERGE-NEXT: - SectionOffset: 7
19 ; MERGE-NEXT: InitFlags: 0
21 ; MERGE: Content: 636F6E7374616E74000000002B
22 ; MERGE-NEXT: - SectionOffset: 26
23 ; MERGE-NEXT: InitFlags: 0
25 ; MERGE: Content: 68656C6C6F00676F6F6462796500776861746576657200002A000000
26 ; MERGE-NEXT: - Type: CUSTOM
27 ; MERGE-NEXT: Name: name
28 ; MERGE-NEXT: FunctionNames:
29 ; MERGE-NEXT: - Index: 0
30 ; MERGE-NEXT: Name: __wasm_call_ctors
31 ; MERGE-NEXT: GlobalNames:
32 ; MERGE-NEXT: - Index: 0
33 ; MERGE-NEXT: Name: __stack_pointer
34 ; MERGE-NEXT: DataSegmentNames:
35 ; MERGE-NEXT: - Index: 0
36 ; MERGE-NEXT: Name: .rodata
38 ; RUN: wasm-ld -no-gc-sections --no-entry --no-merge-data-segments -o %t.separate.wasm %t.o
39 ; RUN: obj2yaml %t.separate.wasm | FileCheck %s --check-prefix=SEPARATE
41 ; SEPARATE-NOT: DATACOUNT
42 ; SEPARATE-LABEL: - Type: DATA
43 ; SEPARATE-NEXT: Segments:
44 ; SEPARATE-NEXT: - SectionOffset: 7
45 ; SEPARATE-NEXT: InitFlags: 0
46 ; SEPARATE-NEXT: Offset:
47 ; SEPARATE: Content: 636F6E7374616E7400
48 ; SEPARATE-NEXT: - SectionOffset: 22
49 ; SEPARATE-NEXT: InitFlags: 0
50 ; SEPARATE-NEXT: Offset:
51 ; SEPARATE: Content: 2B
52 ; SEPARATE-NEXT: - SectionOffset: 29
53 ; SEPARATE-NEXT: InitFlags: 0
54 ; SEPARATE-NEXT: Offset:
55 ; SEPARATE: Content: 68656C6C6F00
56 ; SEPARATE-NEXT: - SectionOffset: 41
57 ; SEPARATE-NEXT: InitFlags: 0
58 ; SEPARATE-NEXT: Offset:
59 ; SEPARATE: Content: 676F6F6462796500
60 ; SEPARATE-NEXT: - SectionOffset: 55
61 ; SEPARATE-NEXT: InitFlags: 0
62 ; SEPARATE-NEXT: Offset:
63 ; SEPARATE: Content: '776861746576657200'
64 ; SEPARATE-NEXT: - SectionOffset: 70
65 ; SEPARATE-NEXT: InitFlags: 0
66 ; SEPARATE-NEXT: Offset:
67 ; SEPARATE: Content: 2A000000
68 ; SEPARATE-NEXT: - Type: CUSTOM
69 ; SEPARATE-NEXT: Name: name
70 ; SEPARATE-NEXT: FunctionNames:
71 ; SEPARATE-NEXT: - Index: 0
72 ; SEPARATE-NEXT: Name: __wasm_call_ctors
73 ; SEPARATE-NEXT: GlobalNames:
74 ; SEPARATE-NEXT: - Index: 0
75 ; SEPARATE-NEXT: Name: __stack_pointer
76 ; SEPARATE-NEXT: DataSegmentNames:
77 ; SEPARATE-NEXT: - Index: 0
78 ; SEPARATE-NEXT: Name: .rodata
80 ; RUN: wasm-ld -no-gc-sections --no-entry --shared-memory --max-memory=131072 -o %t.merged.passive.wasm %t.passive.o
81 ; RUN: obj2yaml %t.merged.passive.wasm | FileCheck %s --check-prefix=PASSIVE-MERGE
82 ; RUN: wasm-ld -mwasm64 -no-gc-sections --no-entry --shared-memory --max-memory=131072 -o %t.merged.passive64.wasm %t.passive64.o
83 ; RUN: obj2yaml %t.merged.passive64.wasm | FileCheck %s --check-prefix=PASSIVE-MERGE
85 ; PASSIVE-MERGE-LABEL: - Type: DATACOUNT
86 ; PASSIVE-MERGE-NEXT: Count: 2
87 ; PASSIVE-MERGE-LABEL: - Type: DATA
88 ; PASSIVE-MERGE-NEXT: Segments:
89 ; PASSIVE-MERGE-NEXT: - SectionOffset: 3
90 ; PASSIVE-MERGE-NEXT: InitFlags: 1
91 ; PASSIVE-MERGE-NEXT: Content: 636F6E7374616E74000000002B
92 ; PASSIVE-MERGE-NEXT: - SectionOffset: 18
93 ; PASSIVE-MERGE-NEXT: InitFlags: 1
94 ; PASSIVE-MERGE-NEXT: Content: 68656C6C6F00676F6F6462796500776861746576657200002A000000
95 ; PASSIVE-MERGE-NEXT: - Type: CUSTOM
96 ; PASSIVE-MERGE-NEXT: Name: name
97 ; PASSIVE-MERGE-NEXT: FunctionNames:
98 ; PASSIVE-MERGE-NEXT: - Index: 0
99 ; PASSIVE-MERGE-NEXT: Name: __wasm_call_ctors
100 ; PASSIVE-MERGE-NEXT: - Index: 1
101 ; PASSIVE-MERGE-NEXT: Name: __wasm_init_tls
102 ; PASSIVE-MERGE-NEXT: - Index: 2
103 ; PASSIVE-MERGE-NEXT: Name: __wasm_init_memory
105 ; RUN: wasm-ld -no-gc-sections --no-entry --shared-memory --max-memory=131072 --no-merge-data-segments -o %t.separate.passive.wasm %t.passive.o
106 ; RUN: obj2yaml %t.separate.passive.wasm | FileCheck %s --check-prefix=PASSIVE-SEPARATE
107 ; RUN: wasm-ld -mwasm64 -no-gc-sections --no-entry --shared-memory --max-memory=131072 --no-merge-data-segments -o %t.separate.passive64.wasm %t.passive64.o
108 ; RUN: obj2yaml %t.separate.passive64.wasm | FileCheck %s --check-prefix=PASSIVE-SEPARATE
110 ; PASSIVE-SEPARATE-LABEL: - Type: DATACOUNT
111 ; PASSIVE-SEPARATE-NEXT: Count: 6
112 ; PASSIVE-SEPARATE-LABEL: - Type: DATA
113 ; PASSIVE-SEPARATE-NEXT: Segments:
114 ; PASSIVE-SEPARATE-NEXT: - SectionOffset: 3
115 ; PASSIVE-SEPARATE-NEXT: InitFlags: 1
116 ; PASSIVE-SEPARATE-NEXT: Content: 636F6E7374616E7400
117 ; PASSIVE-SEPARATE-NEXT: - SectionOffset: 14
118 ; PASSIVE-SEPARATE-NEXT: InitFlags: 1
119 ; PASSIVE-SEPARATE-NEXT: Content: 2B
120 ; PASSIVE-SEPARATE-NEXT: - SectionOffset: 17
121 ; PASSIVE-SEPARATE-NEXT: InitFlags: 1
122 ; PASSIVE-SEPARATE-NEXT: Content: 68656C6C6F00
123 ; PASSIVE-SEPARATE-NEXT: - SectionOffset: 25
124 ; PASSIVE-SEPARATE-NEXT: InitFlags: 1
125 ; PASSIVE-SEPARATE-NEXT: Content: 676F6F6462796500
126 ; PASSIVE-SEPARATE-NEXT: - SectionOffset: 35
127 ; PASSIVE-SEPARATE-NEXT: InitFlags: 1
128 ; PASSIVE-SEPARATE-NEXT: Content: '776861746576657200'
129 ; PASSIVE-SEPARATE-NEXT: - SectionOffset: 46
130 ; PASSIVE-SEPARATE-NEXT: InitFlags: 1
131 ; PASSIVE-SEPARATE-NEXT: Content: 2A000000
132 ; PASSIVE-SEPARATE-NEXT: - Type: CUSTOM
133 ; PASSIVE-SEPARATE-NEXT: Name: name
134 ; PASSIVE-SEPARATE-NEXT: FunctionNames:
135 ; PASSIVE-SEPARATE-NEXT: - Index: 0
136 ; PASSIVE-SEPARATE-NEXT: Name: __wasm_call_ctors
137 ; PASSIVE-SEPARATE-NEXT: - Index: 1
138 ; PASSIVE-SEPARATE-NEXT: Name: __wasm_init_tls
139 ; PASSIVE-SEPARATE-NEXT: - Index: 2
140 ; PASSIVE-SEPARATE-NEXT: Name: __wasm_init_memory