1// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -s | FileCheck %s
2
3// Test that these names are accepted.
4
5.section	.note.GNU-stack,"",@progbits
6.section	.note.GNU-stack2,"",%progbits
7.section	.note.GNU-,"",@progbits
8.section	-.note.GNU,"","progbits"
9
10// CHECK: Name: .note.GNU-stack
11// CHECK: Name: .note.GNU-stack2
12// CHECK: Name: .note.GNU-
13// CHECK: Name: -.note.GNU
14
15// Test that the defaults are used
16
17.section	.init
18.section	.fini
19.section	.rodata
20.section	zed, ""
21
22// CHECK:        Section {
23// CHECK:          Name: .init
24// CHECK-NEXT:     Type: SHT_PROGBITS
25// CHECK-NEXT:     Flags [
26// CHECK-NEXT:       SHF_ALLOC
27// CHECK-NEXT:       SHF_EXECINSTR
28// CHECK-NEXT:     ]
29// CHECK-NEXT:     Address: 0x0
30// CHECK-NEXT:     Offset:
31// CHECK-NEXT:     Size: 0
32// CHECK-NEXT:     Link: 0
33// CHECK-NEXT:     Info: 0
34// CHECK-NEXT:     AddressAlignment: 1
35// CHECK-NEXT:     EntrySize: 0
36// CHECK-NEXT:   }
37// CHECK-NEXT:   Section {
38// CHECK-NEXT:     Index:
39// CHECK-NEXT:     Name: .fini
40// CHECK-NEXT:     Type: SHT_PROGBITS
41// CHECK-NEXT:     Flags [
42// CHECK-NEXT:       SHF_ALLOC
43// CHECK-NEXT:       SHF_EXECINSTR
44// CHECK-NEXT:     ]
45// CHECK-NEXT:     Address: 0x0
46// CHECK-NEXT:     Offset:
47// CHECK-NEXT:     Size: 0
48// CHECK-NEXT:     Link: 0
49// CHECK-NEXT:     Info: 0
50// CHECK-NEXT:     AddressAlignment: 1
51// CHECK-NEXT:     EntrySize: 0
52// CHECK-NEXT:   }
53// CHECK-NEXT:   Section {
54// CHECK-NEXT:     Index:
55// CHECK-NEXT:     Name: .rodata
56// CHECK-NEXT:     Type: SHT_PROGBITS
57// CHECK-NEXT:     Flags [
58// CHECK-NEXT:       SHF_ALLOC
59// CHECK-NEXT:     ]
60// CHECK-NEXT:     Address: 0x0
61// CHECK-NEXT:     Offset:
62// CHECK-NEXT:     Size: 0
63// CHECK-NEXT:     Link: 0
64// CHECK-NEXT:     Info: 0
65// CHECK-NEXT:     AddressAlignment: 1
66// CHECK-NEXT:     EntrySize: 0
67// CHECK-NEXT:   }
68// CHECK-NEXT:   Section {
69// CHECK-NEXT:     Index:
70// CHECK-NEXT:     Name: zed
71// CHECK-NEXT:     Type: SHT_PROGBITS
72// CHECK-NEXT:     Flags [
73// CHECK-NEXT:     ]
74// CHECK-NEXT:     Address: 0x0
75// CHECK-NEXT:     Offset:
76// CHECK-NEXT:     Size: 0
77// CHECK-NEXT:     Link: 0
78// CHECK-NEXT:     Info: 0
79// CHECK-NEXT:     AddressAlignment: 1
80// CHECK-NEXT:     EntrySize: 0
81// CHECK-NEXT:   }
82
83.section	.note.test,"",@note
84// CHECK:        Section {
85// CHECK:          Name: .note.test
86// CHECK-NEXT:     Type: SHT_NOTE
87// CHECK-NEXT:     Flags [
88// CHECK-NEXT:     ]
89// CHECK-NEXT:     Address: 0x0
90// CHECK-NEXT:     Offset:
91// CHECK-NEXT:     Size: 0
92// CHECK-NEXT:     Link: 0
93// CHECK-NEXT:     Info: 0
94// CHECK-NEXT:     AddressAlignment: 1
95// CHECK-NEXT:     EntrySize: 0
96// CHECK-NEXT:   }
97
98// Test that we can parse these
99foo:
100bar:
101.section        .text.foo,"axG",@progbits,foo,comdat
102.section        .text.bar,"axMG",@progbits,42,bar,comdat
103
104// Test that the default values are not used
105
106.section .eh_frame,"a",@unwind
107
108// CHECK:        Section {
109// CHECK:          Name: .eh_frame
110// CHECK-NEXT:     Type: SHT_X86_64_UNWIND
111// CHECK-NEXT:     Flags [
112// CHECK-NEXT:       SHF_ALLOC
113// CHECK-NEXT:     ]
114// CHECK-NEXT:     Address: 0x0
115// CHECK-NEXT:     Offset:
116// CHECK-NEXT:     Size: 0
117// CHECK-NEXT:     Link: 0
118// CHECK-NEXT:     Info: 0
119// CHECK-NEXT:     AddressAlignment: 1
120// CHECK-NEXT:     EntrySize: 0
121// CHECK-NEXT:   }
122
123.section .excluded,"e",@progbits
124
125// CHECK:      Section {
126// CHECK:        Name: .excluded
127// CHECK-NEXT:   Type: SHT_PROGBITS (0x1)
128// CHECK-NEXT:   Flags [ (0x80000000)
129// CHECK-NEXT:     SHF_EXCLUDE (0x80000000)
130// CHECK-NEXT:   ]
131// CHECK-NEXT:   Address: 0x0
132// CHECK-NEXT:   Offset:
133// CHECK-NEXT:   Size: 0
134// CHECK-NEXT:   Link: 0
135// CHECK-NEXT:   Info: 0
136// CHECK-NEXT:   AddressAlignment: 1
137// CHECK-NEXT:   EntrySize: 0
138// CHECK-NEXT: }
139
140// Test that we handle the strings like gas
141.section bar-"foo"
142.section "foo"
143
144// CHECK:        Section {
145// CHECK:          Name: bar-"foo"
146// CHECK:        Section {
147// CHECK:          Name: foo
148