1 ## This test is based on a trimmed down version of the binary built as follows:
3 ## __attribute__((used)) static int PrivateSymbol;
4 ## __attribute__((visibility("hidden"))) int PrivateExternalSymbol;
5 ## __attribute__((used)) int CommonSymbol;
6 ## extern int UndefinedExternalSymbol;
7 ## // Defined external symbol
9 ## return PrivateSymbol + PrivateExternalSymbol + CommonSymbol +
10 ## UndefinedExternalSymbol;
13 ## clang -g -fno-exceptions -fno-unwind-tables -undefined dynamic_lookup \
15 ## All the load commands except the symbol table and its transitive dependencies
18 # RUN: yaml2obj %s -o %t
19 # RUN: llvm-objcopy %t %t.copy
22 ## Verify that the binary is valid and check its symbol table.
23 # RUN: llvm-readobj --symbols %t.copy | FileCheck %s
26 # CHECK-NEXT: Symbol {
27 # CHECK-NEXT: Name: _PrivateSymbol (170)
28 # CHECK-NEXT: Type: Section (0xE)
29 # CHECK-NEXT: Section: __bss (0x4)
30 # CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
31 # CHECK-NEXT: Flags [ (0x0)
33 # CHECK-NEXT: Value: 0x100001008
35 # CHECK-NEXT: Symbol {
36 # CHECK-NEXT: Name: _PrivateExternalSymbol (122)
37 # CHECK-NEXT: PrivateExtern
38 # CHECK-NEXT: Type: Section (0xE)
39 # CHECK-NEXT: Section: __common (0x5)
40 # CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
41 # CHECK-NEXT: Flags [ (0x0)
43 # CHECK-NEXT: Value: 0x100001010
45 # CHECK-NEXT: Symbol {
46 # CHECK-NEXT: Name: /Users/aaaaaaaa/ (192)
47 # CHECK-NEXT: Type: SymDebugTable (0x64)
48 # CHECK-NEXT: Section: (0x0)
49 # CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
50 # CHECK-NEXT: Flags [ (0x0)
52 # CHECK-NEXT: Value: 0x0
54 # CHECK-NEXT: Symbol {
55 # CHECK-NEXT: Name: main.c (185)
56 # CHECK-NEXT: Type: SymDebugTable (0x64)
57 # CHECK-NEXT: Section: (0x0)
58 # CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
59 # CHECK-NEXT: Flags [ (0x0)
61 # CHECK-NEXT: Value: 0x0
63 # CHECK-NEXT: Symbol {
64 # CHECK-NEXT: Name: /var/folders/1d/zyfdpp7j2995h5hqspjy28bc0000gn/T/main-c5ac21.o (39)
65 # CHECK-NEXT: Type: SymDebugTable (0x66)
66 # CHECK-NEXT: Section: (0x3)
67 # CHECK-NEXT: RefType: ReferenceFlagUndefinedLazy (0x1)
68 # CHECK-NEXT: Flags [ (0x0)
70 # CHECK-NEXT: Value: 0x5EA74C81
72 # CHECK-NEXT: Symbol {
73 # CHECK-NEXT: Name: (208)
74 # CHECK-NEXT: Type: SymDebugTable (0x2E)
75 # CHECK-NEXT: Section: (0x1)
76 # CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
77 # CHECK-NEXT: Flags [ (0x0)
79 # CHECK-NEXT: Value: 0x100000F80
81 # CHECK-NEXT: Symbol {
82 # CHECK-NEXT: Name: _main (102)
83 # CHECK-NEXT: Type: SymDebugTable (0x24)
84 # CHECK-NEXT: Section: (0x1)
85 # CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
86 # CHECK-NEXT: Flags [ (0x0)
88 # CHECK-NEXT: Value: 0x100000F80
90 # CHECK-NEXT: Symbol {
91 # CHECK-NEXT: Name: (208)
92 # CHECK-NEXT: Type: SymDebugTable (0x24)
93 # CHECK-NEXT: Section: (0x0)
94 # CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
95 # CHECK-NEXT: Flags [ (0x0)
97 # CHECK-NEXT: Value: 0x2D
99 # CHECK-NEXT: Symbol {
100 # CHECK-NEXT: Name: (208)
101 # CHECK-NEXT: Type: SymDebugTable (0x4E)
102 # CHECK-NEXT: Section: (0x1)
103 # CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
104 # CHECK-NEXT: Flags [ (0x0)
106 # CHECK-NEXT: Value: 0x2D
108 # CHECK-NEXT: Symbol {
109 # CHECK-NEXT: Name: _PrivateSymbol (170)
110 # CHECK-NEXT: Type: SymDebugTable (0x26)
111 # CHECK-NEXT: Section: (0x4)
112 # CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
113 # CHECK-NEXT: Flags [ (0x0)
115 # CHECK-NEXT: Value: 0x100001008
117 # CHECK-NEXT: Symbol {
118 # CHECK-NEXT: Name: _CommonSymbol (108)
119 # CHECK-NEXT: Type: SymDebugTable (0x20)
120 # CHECK-NEXT: Section: (0x0)
121 # CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
122 # CHECK-NEXT: Flags [ (0x0)
124 # CHECK-NEXT: Value: 0x0
126 # CHECK-NEXT: Symbol {
127 # CHECK-NEXT: Name: _PrivateExternalSymbol (122)
128 # CHECK-NEXT: Type: SymDebugTable (0x20)
129 # CHECK-NEXT: Section: (0x0)
130 # CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
131 # CHECK-NEXT: Flags [ (0x0)
133 # CHECK-NEXT: Value: 0x0
135 # CHECK-NEXT: Symbol {
136 # CHECK-NEXT: Name: (208)
137 # CHECK-NEXT: Type: SymDebugTable (0x64)
138 # CHECK-NEXT: Section: (0x1)
139 # CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
140 # CHECK-NEXT: Flags [ (0x0)
142 # CHECK-NEXT: Value: 0x0
144 # CHECK-NEXT: Symbol {
145 # CHECK-NEXT: Name: _CommonSymbol (108)
147 # CHECK-NEXT: Type: Section (0xE)
148 # CHECK-NEXT: Section: __common (0x5)
149 # CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
150 # CHECK-NEXT: Flags [ (0x0)
152 # CHECK-NEXT: Value: 0x10000100C
154 # CHECK-NEXT: Symbol {
155 # CHECK-NEXT: Name: __mh_execute_header (19)
157 # CHECK-NEXT: Type: Section (0xE)
158 # CHECK-NEXT: Section: __text (0x1)
159 # CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
160 # CHECK-NEXT: Flags [ (0x10)
161 # CHECK-NEXT: ReferencedDynamically (0x10)
163 # CHECK-NEXT: Value: 0x100000000
165 # CHECK-NEXT: Symbol {
166 # CHECK-NEXT: Name: _main (102)
168 # CHECK-NEXT: Type: Section (0xE)
169 # CHECK-NEXT: Section: __text (0x1)
170 # CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
171 # CHECK-NEXT: Flags [ (0x0)
173 # CHECK-NEXT: Value: 0x100000F80
175 # CHECK-NEXT: Symbol {
176 # CHECK-NEXT: Name: _UndefinedExternalSymbol (145)
178 # CHECK-NEXT: Type: Undef (0x0)
179 # CHECK-NEXT: Section: (0x0)
180 # CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
181 # CHECK-NEXT: Flags [ (0xFE00)
182 # CHECK-NEXT: AltEntry (0x200)
183 # CHECK-NEXT: ColdFunc (0x400)
185 # CHECK-NEXT: Value: 0x0
187 # CHECK-NEXT: Symbol {
188 # CHECK-NEXT: Name: dyld_stub_binder (2)
190 # CHECK-NEXT: Type: Undef (0x0)
191 # CHECK-NEXT: Section: (0x0)
192 # CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
193 # CHECK-NEXT: Flags [ (0x100)
194 # CHECK-NEXT: SymbolResolver (0x100)
196 # CHECK-NEXT: Value: 0x0
204 cpusubtype: 0x80000003
225 addr: 0x0000000100000F80
232 reserved1: 0x00000000
233 reserved2: 0x00000000
234 reserved3: 0x00000000
235 content: 554889E5488B0575000000488D0D7A000000C745FC000000008B156900000003156B0000000311031089D05DC3
236 - sectname: __unwind_info
238 addr: 0x0000000100000FB0
245 reserved1: 0x00000000
246 reserved2: 0x00000000
247 reserved3: 0x00000000
248 content: 010000001C000000000000001C000000000000001C00000002000000800F00003400000034000000AE0F00000000000034000000030000000C000100100001000000000000000000
263 addr: 0x0000000100001000
270 reserved1: 0x00000000
271 reserved2: 0x00000000
272 reserved3: 0x00000000
273 content: '0000000000000000'
276 addr: 0x0000000100001008
283 reserved1: 0x00000000
284 reserved2: 0x00000000
285 reserved3: 0x00000000
288 addr: 0x000000010000100C
295 reserved1: 0x00000000
296 reserved2: 0x00000000
297 reserved3: 0x00000000
430 - __mh_execute_header
431 - '/var/folders/1d/zyfdpp7j2995h5hqspjy28bc0000gn/T/main-c5ac21.o'
434 - _PrivateExternalSymbol
435 - _UndefinedExternalSymbol