[ELF] Make SyntheticSection parameter order match InputSection
[llvm-project.git] / lld / test / ELF / symbols.s
blob0b56c8ab548f84ec49624dc246dd76e1051dbe39
1 // REQUIRES: x86
2 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
3 // RUN: ld.lld %t -o %t2
4 // RUN: llvm-readobj --symbols --sections %t2 | FileCheck %s
6 .type _start, @function
7 .globl _start
8 _start:
10 .type foo, @object
11 .weak foo
12 foo:
14 .type bar, @object
15 .weak bar
16 .long bar
18 .section foobar,"a",@nobits,unique,1
19 .globl zed
20 zed:
21 .long 0
22 .globl zed2
23 zed2:
24 .long 0
26 .section foobar,"a",@nobits,unique,2
27 .globl zed3
28 .size zed3, 4
29 zed3:
31 .globl abs
32 abs = 0x123
34 .comm common,4,4
36 .global protected
37 .protected protected
38 protected:
40 .global hidden
41 .hidden hidden
42 hidden:
44 .global internal
45 .internal internal
46 internal:
48 // CHECK: Name: foobar
49 // CHECK-NEXT: Type: SHT_NOBITS
50 // CHECK-NEXT: Flags [
51 // CHECK-NEXT: SHF_ALLOC
52 // CHECK-NEXT: ]
53 // CHECK-NEXT: Address: 0x200158
55 // CHECK: Name: .text
56 // CHECK-NEXT: Type: SHT_PROGBITS
57 // CHECK-NEXT: Flags [
58 // CHECK-NEXT: SHF_ALLOC
59 // CHECK-NEXT: SHF_EXECINSTR
60 // CHECK-NEXT: ]
61 // CHECK-NEXT: Address: 0x201160
63 // CHECK: Name: .bss
64 // CHECK-NEXT: Type: SHT_NOBITS
65 // CHECK-NEXT: Flags [
66 // CHECK-NEXT: SHF_ALLOC
67 // CHECK-NEXT: SHF_WRITE
68 // CHECK-NEXT: ]
69 // CHECK-NEXT: Address: 0x202164
70 // CHECK-NEXT: Offset:
71 // CHECK-NEXT: Size: 4
73 // CHECK: Symbols [
74 // CHECK-NEXT: Symbol {
75 // CHECK-NEXT: Name: (0)
76 // CHECK-NEXT: Value: 0x0
77 // CHECK-NEXT: Size: 0
78 // CHECK-NEXT: Binding: Local (0x0)
79 // CHECK-NEXT: Type: None (0x0)
80 // CHECK-NEXT: Other: 0
81 // CHECK-NEXT: Section: Undefined (0x0)
82 // CHECK-NEXT: }
83 // CHECK-NEXT: Symbol {
84 // CHECK-NEXT: Name: hidden
85 // CHECK-NEXT: Value: 0x200160
86 // CHECK-NEXT: Size: 0
87 // CHECK-NEXT: Binding: Local
88 // CHECK-NEXT: Type: None
89 // CHECK-NEXT: Other [ (0x2)
90 // CHECK-NEXT: STV_HIDDEN
91 // CHECK-NEXT: ]
92 // CHECK-NEXT: Section: foobar
93 // CHECK-NEXT: }
94 // CHECK-NEXT: Symbol {
95 // CHECK-NEXT: Name: internal
96 // CHECK-NEXT: Value: 0x200160
97 // CHECK-NEXT: Size: 0
98 // CHECK-NEXT: Binding: Local
99 // CHECK-NEXT: Type: None
100 // CHECK-NEXT: Other [ (0x1)
101 // CHECK-NEXT: STV_INTERNAL
102 // CHECK-NEXT: ]
103 // CHECK-NEXT: Section: foobar
104 // CHECK-NEXT: }
105 // CHECK-NEXT: Symbol {
106 // CHECK-NEXT: Name: _start
107 // CHECK-NEXT: Value: 0x201160
108 // CHECK-NEXT: Size: 0
109 // CHECK-NEXT: Binding: Global (0x1)
110 // CHECK-NEXT: Type: Function
111 // CHECK-NEXT: Other: 0
112 // CHECK-NEXT: Section: .text
113 // CHECK-NEXT: }
114 // CHECK-NEXT: Symbol {
115 // CHECK-NEXT: Name: foo
116 // CHECK-NEXT: Value: 0x201160
117 // CHECK-NEXT: Size: 0
118 // CHECK-NEXT: Binding: Weak (0x2)
119 // CHECK-NEXT: Type: Object
120 // CHECK-NEXT: Other: 0
121 // CHECK-NEXT: Section: .text
122 // CHECK-NEXT: }
123 // CHECK-NEXT: Symbol {
124 // CHECK-NEXT: Name: bar
125 // CHECK-NEXT: Value: 0x0
126 // CHECK-NEXT: Size: 0
127 // CHECK-NEXT: Binding: Weak (0x2)
128 // CHECK-NEXT: Type: Object (0x1)
129 // CHECK-NEXT: Other: 0
130 // CHECK-NEXT: Section: Undefined (0x0)
131 // CHECK-NEXT: }
132 // CHECK-NEXT: Symbol {
133 // CHECK-NEXT: Name: zed
134 // CHECK-NEXT: Value: 0x200158
135 // CHECK-NEXT: Size: 0
136 // CHECK-NEXT: Binding: Global (0x1)
137 // CHECK-NEXT: Type: None
138 // CHECK-NEXT: Other: 0
139 // CHECK-NEXT: Section: foobar
140 // CHECK-NEXT: }
141 // CHECK-NEXT: Symbol {
142 // CHECK-NEXT: Name: zed2
143 // CHECK-NEXT: Value: 0x20015C
144 // CHECK-NEXT: Size: 0
145 // CHECK-NEXT: Binding: Global
146 // CHECK-NEXT: Type: None
147 // CHECK-NEXT: Other: 0
148 // CHECK-NEXT: Section: foobar
149 // CHECK-NEXT: }
150 // CHECK-NEXT: Symbol {
151 // CHECK-NEXT: Name: zed3
152 // CHECK-NEXT: Value: 0x200160
153 // CHECK-NEXT: Size: 4
154 // CHECK-NEXT: Binding: Global
155 // CHECK-NEXT: Type: None
156 // CHECK-NEXT: Other: 0
157 // CHECK-NEXT: Section: foobar
158 // CHECK-NEXT: }
159 // CHECK-NEXT: Symbol {
160 // CHECK-NEXT: Name: abs
161 // CHECK-NEXT: Value: 0x123
162 // CHECK-NEXT: Size: 0
163 // CHECK-NEXT: Binding: Global
164 // CHECK-NEXT: Type: None
165 // CHECK-NEXT: Other: 0
166 // CHECK-NEXT: Section: Absolute
167 // CHECK-NEXT: }
168 // CHECK-NEXT: Symbol {
169 // CHECK-NEXT: Name: common
170 // CHECK-NEXT: Value: 0x202164
171 // CHECK-NEXT: Size: 4
172 // CHECK-NEXT: Binding: Global
173 // CHECK-NEXT: Type: Object
174 // CHECK-NEXT: Other: 0
175 // CHECK-NEXT: Section: .bss
176 // CHECK-NEXT: }
177 // CHECK-NEXT: Symbol {
178 // CHECK-NEXT: Name: protected
179 // CHECK-NEXT: Value: 0x200160
180 // CHECK-NEXT: Size: 0
181 // CHECK-NEXT: Binding: Global
182 // CHECK-NEXT: Type: None
183 // CHECK-NEXT: Other [ (0x3)
184 // CHECK-NEXT: STV_PROTECTED
185 // CHECK-NEXT: ]
186 // CHECK-NEXT: Section: foobar
187 // CHECK-NEXT: }
188 // CHECK-NEXT: ]