1 // RUN: llvm-mc -triple i386-apple-darwin9 %s -filetype=obj -o - | llvm-readobj -file-headers -s -r -t -macho-segment -macho-dysymtab -macho-indirect-symbols | FileCheck -check-prefix CHECK-X86_32 %s 2 // RUN: llvm-mc -triple x86_64-apple-darwin10 %s -filetype=obj -o - | llvm-readobj -file-headers -s -r -t -macho-segment -macho-dysymtab -macho-indirect-symbols | FileCheck -check-prefix CHECK-X86_64 %s 3 4 sym_local_B: 5 .globl sym_globl_def_B 6 .globl sym_globl_undef_B 7 sym_local_A: 8 .globl sym_globl_def_A 9 .globl sym_globl_undef_A 10 sym_local_C: 11 .globl sym_globl_def_C 12 .globl sym_globl_undef_C 13 14 sym_globl_def_A: 15 sym_globl_def_B: 16 sym_globl_def_C: 17 Lsym_asm_temp: 18 .long 0 19 20 // CHECK-X86_32: File: <stdin> 21 // CHECK-X86_32: Format: Mach-O 32-bit i386 22 // CHECK-X86_32: Arch: i386 23 // CHECK-X86_32: AddressSize: 32bit 24 // CHECK-X86_32: MachHeader { 25 // CHECK-X86_32: Magic: Magic (0xFEEDFACE) 26 // CHECK-X86_32: CpuType: X86 (0x7) 27 // CHECK-X86_32: CpuSubType: CPU_SUBTYPE_I386_ALL (0x3) 28 // CHECK-X86_32: FileType: Relocatable (0x1) 29 // CHECK-X86_32: NumOfLoadCommands: 4 30 // CHECK-X86_32: SizeOfLoadCommands: 244 31 // CHECK-X86_32: Flags [ (0x0) 32 // CHECK-X86_32: ] 33 // CHECK-X86_32: } 34 // CHECK-X86_32: Sections [ 35 // CHECK-X86_32: Section { 36 // CHECK-X86_32: Index: 0 37 // CHECK-X86_32: Name: __text (5F 5F 74 65 78 74 00 00 00 00 00 00 00 00 00 00) 38 // CHECK-X86_32: Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00) 39 // CHECK-X86_32: Address: 0x0 40 // CHECK-X86_32: Size: 0x4 41 // CHECK-X86_32: Offset: 272 42 // CHECK-X86_32: Alignment: 0 43 // CHECK-X86_32: RelocationOffset: 0x0 44 // CHECK-X86_32: RelocationCount: 0 45 // CHECK-X86_32: Type: 0x0 46 // CHECK-X86_32: Attributes [ (0x800000) 47 // CHECK-X86_32: PureInstructions (0x800000) 48 // CHECK-X86_32: ] 49 // CHECK-X86_32: Reserved1: 0x0 50 // CHECK-X86_32: Reserved2: 0x0 51 // CHECK-X86_32: } 52 // CHECK-X86_32: ] 53 // CHECK-X86_32: Relocations [ 54 // CHECK-X86_32: ] 55 // CHECK-X86_32: Symbols [ 56 // CHECK-X86_32: Symbol { 57 // CHECK-X86_32: Name: sym_local_B (47) 58 // CHECK-X86_32: Type: Section (0xE) 59 // CHECK-X86_32: Section: __text (0x1) 60 // CHECK-X86_32: RefType: UndefinedNonLazy (0x0) 61 // CHECK-X86_32: Flags [ (0x0) 62 // CHECK-X86_32: ] 63 // CHECK-X86_32: Value: 0x0 64 // CHECK-X86_32: } 65 // CHECK-X86_32: Symbol { 66 // CHECK-X86_32: Name: sym_local_A (93) 67 // CHECK-X86_32: Type: Section (0xE) 68 // CHECK-X86_32: Section: __text (0x1) 69 // CHECK-X86_32: RefType: UndefinedNonLazy (0x0) 70 // CHECK-X86_32: Flags [ (0x0) 71 // CHECK-X86_32: ] 72 // CHECK-X86_32: Value: 0x0 73 // CHECK-X86_32: } 74 // CHECK-X86_32: Symbol { 75 // CHECK-X86_32: Name: sym_local_C (1) 76 // CHECK-X86_32: Type: Section (0xE) 77 // CHECK-X86_32: Section: __text (0x1) 78 // CHECK-X86_32: RefType: UndefinedNonLazy (0x0) 79 // CHECK-X86_32: Flags [ (0x0) 80 // CHECK-X86_32: ] 81 // CHECK-X86_32: Value: 0x0 82 // CHECK-X86_32: } 83 // CHECK-X86_32: Symbol { 84 // CHECK-X86_32: Name: sym_globl_def_A (123) 85 // CHECK-X86_32: Extern 86 // CHECK-X86_32: Type: Section (0xE) 87 // CHECK-X86_32: Section: __text (0x1) 88 // CHECK-X86_32: RefType: UndefinedNonLazy (0x0) 89 // CHECK-X86_32: Flags [ (0x0) 90 // CHECK-X86_32: ] 91 // CHECK-X86_32: Value: 0x0 92 // CHECK-X86_32: } 93 // CHECK-X86_32: Symbol { 94 // CHECK-X86_32: Name: sym_globl_def_B (77) 95 // CHECK-X86_32: Extern 96 // CHECK-X86_32: Type: Section (0xE) 97 // CHECK-X86_32: Section: __text (0x1) 98 // CHECK-X86_32: RefType: UndefinedNonLazy (0x0) 99 // CHECK-X86_32: Flags [ (0x0) 100 // CHECK-X86_32: ] 101 // CHECK-X86_32: Value: 0x0 102 // CHECK-X86_32: } 103 // CHECK-X86_32: Symbol { 104 // CHECK-X86_32: Name: sym_globl_def_C (31) 105 // CHECK-X86_32: Extern 106 // CHECK-X86_32: Type: Section (0xE) 107 // CHECK-X86_32: Section: __text (0x1) 108 // CHECK-X86_32: RefType: UndefinedNonLazy (0x0) 109 // CHECK-X86_32: Flags [ (0x0) 110 // CHECK-X86_32: ] 111 // CHECK-X86_32: Value: 0x0 112 // CHECK-X86_32: } 113 // CHECK-X86_32: Symbol { 114 // CHECK-X86_32: Name: sym_globl_undef_A (105) 115 // CHECK-X86_32: Extern 116 // CHECK-X86_32: Type: Undef (0x0) 117 // CHECK-X86_32: Section: (0x0) 118 // CHECK-X86_32: RefType: UndefinedNonLazy (0x0) 119 // CHECK-X86_32: Flags [ (0x0) 120 // CHECK-X86_32: ] 121 // CHECK-X86_32: Value: 0x0 122 // CHECK-X86_32: } 123 // CHECK-X86_32: Symbol { 124 // CHECK-X86_32: Name: sym_globl_undef_B (59) 125 // CHECK-X86_32: Extern 126 // CHECK-X86_32: Type: Undef (0x0) 127 // CHECK-X86_32: Section: (0x0) 128 // CHECK-X86_32: RefType: UndefinedNonLazy (0x0) 129 // CHECK-X86_32: Flags [ (0x0) 130 // CHECK-X86_32: ] 131 // CHECK-X86_32: Value: 0x0 132 // CHECK-X86_32: } 133 // CHECK-X86_32: Symbol { 134 // CHECK-X86_32: Name: sym_globl_undef_C (13) 135 // CHECK-X86_32: Extern 136 // CHECK-X86_32: Type: Undef (0x0) 137 // CHECK-X86_32: Section: (0x0) 138 // CHECK-X86_32: RefType: UndefinedNonLazy (0x0) 139 // CHECK-X86_32: Flags [ (0x0) 140 // CHECK-X86_32: ] 141 // CHECK-X86_32: Value: 0x0 142 // CHECK-X86_32: } 143 // CHECK-X86_32: ] 144 // CHECK-X86_32: Indirect Symbols { 145 // CHECK-X86_32: Number: 0 146 // CHECK-X86_32: Symbols [ 147 // CHECK-X86_32: ] 148 // CHECK-X86_32: } 149 // CHECK-X86_32: Segment { 150 // CHECK-X86_32: Cmd: LC_SEGMENT 151 // CHECK-X86_32: Name: 152 // CHECK-X86_32: Size: 124 153 // CHECK-X86_32: vmaddr: 0x0 154 // CHECK-X86_32: vmsize: 0x4 155 // CHECK-X86_32: fileoff: 272 156 // CHECK-X86_32: filesize: 4 157 // CHECK-X86_32: maxprot: rwx 158 // CHECK-X86_32: initprot: rwx 159 // CHECK-X86_32: nsects: 1 160 // CHECK-X86_32: flags: 0x0 161 // CHECK-X86_32: } 162 // CHECK-X86_32: Dysymtab { 163 // CHECK-X86_32: ilocalsym: 0 164 // CHECK-X86_32: nlocalsym: 3 165 // CHECK-X86_32: iextdefsym: 3 166 // CHECK-X86_32: nextdefsym: 3 167 // CHECK-X86_32: iundefsym: 6 168 // CHECK-X86_32: nundefsym: 3 169 // CHECK-X86_32: tocoff: 0 170 // CHECK-X86_32: ntoc: 0 171 // CHECK-X86_32: modtaboff: 0 172 // CHECK-X86_32: nmodtab: 0 173 // CHECK-X86_32: extrefsymoff: 0 174 // CHECK-X86_32: nextrefsyms: 0 175 // CHECK-X86_32: indirectsymoff: 0 176 // CHECK-X86_32: nindirectsyms: 0 177 // CHECK-X86_32: extreloff: 0 178 // CHECK-X86_32: nextrel: 0 179 // CHECK-X86_32: locreloff: 0 180 // CHECK-X86_32: nlocrel: 0 181 // CHECK-X86_32: } 182 183 // CHECK-X86_64: File: <stdin> 184 // CHECK-X86_64: Format: Mach-O 64-bit x86-64 185 // CHECK-X86_64: Arch: x86_64 186 // CHECK-X86_64: AddressSize: 64bit 187 // CHECK-X86_64: MachHeader { 188 // CHECK-X86_64: Magic: Magic64 (0xFEEDFACF) 189 // CHECK-X86_64: CpuType: X86-64 (0x1000007) 190 // CHECK-X86_64: CpuSubType: CPU_SUBTYPE_X86_64_ALL (0x3) 191 // CHECK-X86_64: FileType: Relocatable (0x1) 192 // CHECK-X86_64: NumOfLoadCommands: 4 193 // CHECK-X86_64: SizeOfLoadCommands: 272 194 // CHECK-X86_64: Flags [ (0x0) 195 // CHECK-X86_64: ] 196 // CHECK-X86_64: Reserved: 0x0 197 // CHECK-X86_64: } 198 // CHECK-X86_64: Sections [ 199 // CHECK-X86_64: Section { 200 // CHECK-X86_64: Index: 0 201 // CHECK-X86_64: Name: __text (5F 5F 74 65 78 74 00 00 00 00 00 00 00 00 00 00) 202 // CHECK-X86_64: Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00) 203 // CHECK-X86_64: Address: 0x0 204 // CHECK-X86_64: Size: 0x4 205 // CHECK-X86_64: Offset: 304 206 // CHECK-X86_64: Alignment: 0 207 // CHECK-X86_64: RelocationOffset: 0x0 208 // CHECK-X86_64: RelocationCount: 0 209 // CHECK-X86_64: Type: 0x0 210 // CHECK-X86_64: Attributes [ (0x800000) 211 // CHECK-X86_64: PureInstructions (0x800000) 212 // CHECK-X86_64: ] 213 // CHECK-X86_64: Reserved1: 0x0 214 // CHECK-X86_64: Reserved2: 0x0 215 // CHECK-X86_64: Reserved3: 0x0 216 // CHECK-X86_64: } 217 // CHECK-X86_64: ] 218 // CHECK-X86_64: Relocations [ 219 // CHECK-X86_64: ] 220 // CHECK-X86_64: Symbols [ 221 // CHECK-X86_64: Symbol { 222 // CHECK-X86_64: Name: sym_local_B (47) 223 // CHECK-X86_64: Type: Section (0xE) 224 // CHECK-X86_64: Section: __text (0x1) 225 // CHECK-X86_64: RefType: UndefinedNonLazy (0x0) 226 // CHECK-X86_64: Flags [ (0x0) 227 // CHECK-X86_64: ] 228 // CHECK-X86_64: Value: 0x0 229 // CHECK-X86_64: } 230 // CHECK-X86_64: Symbol { 231 // CHECK-X86_64: Name: sym_local_A (93) 232 // CHECK-X86_64: Type: Section (0xE) 233 // CHECK-X86_64: Section: __text (0x1) 234 // CHECK-X86_64: RefType: UndefinedNonLazy (0x0) 235 // CHECK-X86_64: Flags [ (0x0) 236 // CHECK-X86_64: ] 237 // CHECK-X86_64: Value: 0x0 238 // CHECK-X86_64: } 239 // CHECK-X86_64: Symbol { 240 // CHECK-X86_64: Name: sym_local_C (1) 241 // CHECK-X86_64: Type: Section (0xE) 242 // CHECK-X86_64: Section: __text (0x1) 243 // CHECK-X86_64: RefType: UndefinedNonLazy (0x0) 244 // CHECK-X86_64: Flags [ (0x0) 245 // CHECK-X86_64: ] 246 // CHECK-X86_64: Value: 0x0 247 // CHECK-X86_64: } 248 // CHECK-X86_64: Symbol { 249 // CHECK-X86_64: Name: sym_globl_def_A (123) 250 // CHECK-X86_64: Extern 251 // CHECK-X86_64: Type: Section (0xE) 252 // CHECK-X86_64: Section: __text (0x1) 253 // CHECK-X86_64: RefType: UndefinedNonLazy (0x0) 254 // CHECK-X86_64: Flags [ (0x0) 255 // CHECK-X86_64: ] 256 // CHECK-X86_64: Value: 0x0 257 // CHECK-X86_64: } 258 // CHECK-X86_64: Symbol { 259 // CHECK-X86_64: Name: sym_globl_def_B (77) 260 // CHECK-X86_64: Extern 261 // CHECK-X86_64: Type: Section (0xE) 262 // CHECK-X86_64: Section: __text (0x1) 263 // CHECK-X86_64: RefType: UndefinedNonLazy (0x0) 264 // CHECK-X86_64: Flags [ (0x0) 265 // CHECK-X86_64: ] 266 // CHECK-X86_64: Value: 0x0 267 // CHECK-X86_64: } 268 // CHECK-X86_64: Symbol { 269 // CHECK-X86_64: Name: sym_globl_def_C (31) 270 // CHECK-X86_64: Extern 271 // CHECK-X86_64: Type: Section (0xE) 272 // CHECK-X86_64: Section: __text (0x1) 273 // CHECK-X86_64: RefType: UndefinedNonLazy (0x0) 274 // CHECK-X86_64: Flags [ (0x0) 275 // CHECK-X86_64: ] 276 // CHECK-X86_64: Value: 0x0 277 // CHECK-X86_64: } 278 // CHECK-X86_64: Symbol { 279 // CHECK-X86_64: Name: sym_globl_undef_A (105) 280 // CHECK-X86_64: Extern 281 // CHECK-X86_64: Type: Undef (0x0) 282 // CHECK-X86_64: Section: (0x0) 283 // CHECK-X86_64: RefType: UndefinedNonLazy (0x0) 284 // CHECK-X86_64: Flags [ (0x0) 285 // CHECK-X86_64: ] 286 // CHECK-X86_64: Value: 0x0 287 // CHECK-X86_64: } 288 // CHECK-X86_64: Symbol { 289 // CHECK-X86_64: Name: sym_globl_undef_B (59) 290 // CHECK-X86_64: Extern 291 // CHECK-X86_64: Type: Undef (0x0) 292 // CHECK-X86_64: Section: (0x0) 293 // CHECK-X86_64: RefType: UndefinedNonLazy (0x0) 294 // CHECK-X86_64: Flags [ (0x0) 295 // CHECK-X86_64: ] 296 // CHECK-X86_64: Value: 0x0 297 // CHECK-X86_64: } 298 // CHECK-X86_64: Symbol { 299 // CHECK-X86_64: Name: sym_globl_undef_C (13) 300 // CHECK-X86_64: Extern 301 // CHECK-X86_64: Type: Undef (0x0) 302 // CHECK-X86_64: Section: (0x0) 303 // CHECK-X86_64: RefType: UndefinedNonLazy (0x0) 304 // CHECK-X86_64: Flags [ (0x0) 305 // CHECK-X86_64: ] 306 // CHECK-X86_64: Value: 0x0 307 // CHECK-X86_64: } 308 // CHECK-X86_64: ] 309 // CHECK-X86_64: Indirect Symbols { 310 // CHECK-X86_64: Number: 0 311 // CHECK-X86_64: Symbols [ 312 // CHECK-X86_64: ] 313 // CHECK-X86_64: } 314 // CHECK-X86_64: Segment { 315 // CHECK-X86_64: Cmd: LC_SEGMENT_64 316 // CHECK-X86_64: Name: 317 // CHECK-X86_64: Size: 152 318 // CHECK-X86_64: vmaddr: 0x0 319 // CHECK-X86_64: vmsize: 0x4 320 // CHECK-X86_64: fileoff: 304 321 // CHECK-X86_64: filesize: 4 322 // CHECK-X86_64: maxprot: rwx 323 // CHECK-X86_64: initprot: rwx 324 // CHECK-X86_64: nsects: 1 325 // CHECK-X86_64: flags: 0x0 326 // CHECK-X86_64: } 327 // CHECK-X86_64: Dysymtab { 328 // CHECK-X86_64: ilocalsym: 0 329 // CHECK-X86_64: nlocalsym: 3 330 // CHECK-X86_64: iextdefsym: 3 331 // CHECK-X86_64: nextdefsym: 3 332 // CHECK-X86_64: iundefsym: 6 333 // CHECK-X86_64: nundefsym: 3 334 // CHECK-X86_64: tocoff: 0 335 // CHECK-X86_64: ntoc: 0 336 // CHECK-X86_64: modtaboff: 0 337 // CHECK-X86_64: nmodtab: 0 338 // CHECK-X86_64: extrefsymoff: 0 339 // CHECK-X86_64: nextrefsyms: 0 340 // CHECK-X86_64: indirectsymoff: 0 341 // CHECK-X86_64: nindirectsyms: 0 342 // CHECK-X86_64: extreloff: 0 343 // CHECK-X86_64: nextrel: 0 344 // CHECK-X86_64: locreloff: 0 345 // CHECK-X86_64: nlocrel: 0 346 // CHECK-X86_64: } 347