1 // RUN
: llvm-mc
-triple i386-pc-win32
-filetype
=obj
%s | llvm-readobj
-S
- | FileCheck
%s
2 // RUN
: llvm-mc
-triple x86_64-pc-win32
-filetype
=obj
%s | llvm-readobj
-S
- | FileCheck
%s
3 // RUN
: not llvm-mc
-triple x86_64-pc-win32
-filetype
=obj
--defsym ERR
=1 %s
-o
/dev
/null
2>&1 | FileCheck
%s
--check-prefix
=ERR
5 .section .foo$bar; .long 1
6 .section .foo@bar; .long 1
7 .section ABCDEFGHIJKLMNOPQRSTUVWXYZ; .long 1
8 .section abcdefghijklmnopqrstuvwxyz; .long 1
9 .section _0123456789; .long 1
13 // CHECK
: Name
: .foo$bar
16 // CHECK
: Name
: .foo@bar
19 // CHECK
: Name
: ABCDEFGHIJKLMNOPQRSTUVWXYZ
22 // CHECK
: Name
: abcdefghijklmnopqrstuvwxyz
25 // CHECK
: Name
: _0123456789
28 // Test that the defaults are used
30 .section s_, "" ; .long 1
31 .section s_a,"a"; .long 1
32 .section s_b,"b"; .long 1
33 .section s_d,"d"; .long 1
34 .section s_D,"D"; .long 1
35 .section s_n,"n"; .long 1
36 .section s_r,"r"; .long 1
37 .section s_s,"s"; .long 1
38 .section s_w,"w"; .long 1
39 .section s_x,"x"; .long 1
40 .section s_y,"y"; .long 1
41 .section s_i,"i"; .long 1
45 // CHECK
: Characteristics
[
46 // CHECK-NEXT
: IMAGE_SCN_ALIGN_1BYTES
47 // CHECK-NEXT
: IMAGE_SCN_CNT_INITIALIZED_DATA
48 // CHECK-NEXT
: IMAGE_SCN_MEM_READ
49 // CHECK-NEXT
: IMAGE_SCN_MEM_WRITE
54 // CHECK
: Characteristics
[
55 // CHECK-NEXT
: IMAGE_SCN_ALIGN_1BYTES
56 // CHECK-NEXT
: IMAGE_SCN_CNT_INITIALIZED_DATA
57 // CHECK-NEXT
: IMAGE_SCN_MEM_READ
58 // CHECK-NEXT
: IMAGE_SCN_MEM_WRITE
63 // CHECK
: Characteristics
[
64 // CHECK-NEXT
: IMAGE_SCN_ALIGN_1BYTES
65 // CHECK-NEXT
: IMAGE_SCN_CNT_INITIALIZED_DATA
66 // CHECK-NEXT
: IMAGE_SCN_MEM_READ
67 // CHECK-NEXT
: IMAGE_SCN_MEM_WRITE
72 // CHECK
: Characteristics
[
73 // CHECK-NEXT
: IMAGE_SCN_ALIGN_1BYTES
74 // CHECK-NEXT
: IMAGE_SCN_CNT_UNINITIALIZED_DATA
75 // CHECK-NEXT
: IMAGE_SCN_MEM_READ
76 // CHECK-NEXT
: IMAGE_SCN_MEM_WRITE
81 // CHECK
: Characteristics
[
82 // CHECK-NEXT
: IMAGE_SCN_ALIGN_1BYTES
83 // CHECK-NEXT
: IMAGE_SCN_CNT_INITIALIZED_DATA
84 // CHECK-NEXT
: IMAGE_SCN_MEM_READ
85 // CHECK-NEXT
: IMAGE_SCN_MEM_WRITE
90 // CHECK
: Characteristics
[
91 // CHECK-NEXT
: IMAGE_SCN_ALIGN_1BYTES
92 // CHECK-NEXT
: IMAGE_SCN_MEM_DISCARDABLE
93 // CHECK-NEXT
: IMAGE_SCN_MEM_READ
94 // CHECK-NEXT
: IMAGE_SCN_MEM_WRITE
99 // CHECK
: Characteristics
[
100 // CHECK-NEXT
: IMAGE_SCN_ALIGN_1BYTES
101 // CHECK-NEXT
: IMAGE_SCN_LNK_REMOVE
102 // CHECK-NEXT
: IMAGE_SCN_MEM_READ
103 // CHECK-NEXT
: IMAGE_SCN_MEM_WRITE
108 // CHECK
: Characteristics
[
109 // CHECK-NEXT
: IMAGE_SCN_ALIGN_1BYTES
110 // CHECK-NEXT
: IMAGE_SCN_CNT_INITIALIZED_DATA
111 // CHECK-NEXT
: IMAGE_SCN_MEM_READ
116 // CHECK
: Characteristics
[
117 // CHECK-NEXT
: IMAGE_SCN_ALIGN_1BYTES
118 // CHECK-NEXT
: IMAGE_SCN_CNT_INITIALIZED_DATA
119 // CHECK-NEXT
: IMAGE_SCN_MEM_READ
120 // CHECK-NEXT
: IMAGE_SCN_MEM_SHARED
121 // CHECK-NEXT
: IMAGE_SCN_MEM_WRITE
126 // CHECK
: Characteristics
[
127 // CHECK-NEXT
: IMAGE_SCN_ALIGN_1BYTES
128 // CHECK-NEXT
: IMAGE_SCN_CNT_INITIALIZED_DATA
129 // CHECK-NEXT
: IMAGE_SCN_MEM_READ
130 // CHECK-NEXT
: IMAGE_SCN_MEM_WRITE
135 // CHECK
: Characteristics
[
136 // CHECK-NEXT
: IMAGE_SCN_ALIGN_1BYTES
137 // CHECK-NEXT
: IMAGE_SCN_CNT_CODE
138 // CHECK-NEXT
: IMAGE_SCN_MEM_EXECUTE
139 // CHECK-NEXT
: IMAGE_SCN_MEM_READ
144 // CHECK
: Characteristics
[
145 // CHECK-NEXT
: IMAGE_SCN_ALIGN_1BYTES
150 // CHECK
: Characteristics
[
151 // CHECK-NEXT
: IMAGE_SCN_ALIGN_1BYTES
152 // CHECK-NEXT
: IMAGE_SCN_LNK_INFO
153 // CHECK-NEXT
: IMAGE_SCN_MEM_READ
154 // CHECK-NEXT
: IMAGE_SCN_MEM_WRITE
158 // w makes read-only to readable
159 .section s_rw,"rw"; .long 1
162 // CHECK
: Characteristics
[
163 // CHECK-NEXT
: IMAGE_SCN_ALIGN_1BYTES
164 // CHECK-NEXT
: IMAGE_SCN_CNT_INITIALIZED_DATA
165 // CHECK-NEXT
: IMAGE_SCN_MEM_READ
166 // CHECK-NEXT
: IMAGE_SCN_MEM_WRITE
171 .section s_wr,"wr"; .long 1
174 // CHECK
: Characteristics
[
175 // CHECK-NEXT
: IMAGE_SCN_ALIGN_1BYTES
176 // CHECK-NEXT
: IMAGE_SCN_CNT_INITIALIZED_DATA
177 // CHECK-NEXT
: IMAGE_SCN_MEM_READ
182 .section s_rwy,"rwy"; .long 1
184 // CHECK
: Name
: s_rwy
185 // CHECK
: Characteristics
[
186 // CHECK-NEXT
: IMAGE_SCN_ALIGN_1BYTES
187 // CHECK-NEXT
: IMAGE_SCN_CNT_INITIALIZED_DATA
191 // Sections starting with
".debug" are implicitly discardable. This is
192 // compatible with gas.
193 .section .debug_asdf,"dr"; .long 1
195 // CHECK
: Name
: .debug_asdf
196 // CHECK
: Characteristics
[
197 // CHECK-NEXT
: IMAGE_SCN_ALIGN_1BYTES
198 // CHECK-NEXT
: IMAGE_SCN_CNT_INITIALIZED_DATA
199 // CHECK-NEXT
: IMAGE_SCN_MEM_DISCARDABLE
200 // CHECK-NEXT
: IMAGE_SCN_MEM_READ
204 /// The section name can
be quoted.
207 // CHECK-NEXT
: Number
:
208 // CHECK-NEXT
: Name
: @
#$-{
210 // CHECK-
NOT: Section
{
213 .section data1; .quad 0
215 .pushsection data2; .quad 0
218 // Back to section data1
222 // CHECK-NEXT
: Number
:
223 // CHECK-NEXT
: Name
: data1
224 // CHECK
: RawDataSize
: 16
227 // CHECK-NEXT
: Number
:
228 // CHECK-NEXT
: Name
: data2
229 // CHECK
: RawDataSize
: 8
231 .section .data3,"dw"; .quad 1
233 .pushsection .data4,"dw"; .quad 1
236 .pushsection .data5,"dr"; .quad 1
242 // Notice the different section flags here.
243 // This shouldn
't overwrite the intial section flags.
244 .pushsection .data4,"dr"; .quad 1
248 // CHECK-NEXT: Number:
249 // CHECK-NEXT: Name: .data3
250 // CHECK: RawDataSize: 16
251 // CHECK: Characteristics [
252 // CHECK-NEXT: IMAGE_SCN_ALIGN_1BYTES
253 // CHECK-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA
254 // CHECK-NEXT: IMAGE_SCN_MEM_READ
255 // CHECK-NEXT: IMAGE_SCN_MEM_WRITE
259 // CHECK-NEXT: Number:
260 // CHECK-NEXT: Name: .data4
261 // CHECK: RawDataSize: 16
262 // CHECK: Characteristics [
263 // CHECK-NEXT: IMAGE_SCN_ALIGN_1BYTES
264 // CHECK-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA
265 // CHECK-NEXT: IMAGE_SCN_MEM_READ
266 // CHECK-NEXT: IMAGE_SCN_MEM_WRITE
270 // CHECK-NEXT: Number:
271 // CHECK-NEXT: Name: .data5
272 // CHECK: RawDataSize: 8
273 // CHECK: Characteristics [
274 // CHECK-NEXT: IMAGE_SCN_ALIGN_1BYTES
275 // CHECK-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA
276 // CHECK-NEXT: IMAGE_SCN_MEM_READ
280 // ERR: :[[#@LINE+1]]:12: error: .popsection without corresponding .pushsection