1// RUN: llvm-mc -triple i386-apple-darwin10 %s -filetype=obj -o %t.o 2// RUN: macho-dump --dump-section-data < %t.o > %t.dump 3// RUN: FileCheck --check-prefix=CHECK-I386 < %t.dump %s 4 5// RUN: llvm-mc -triple x86_64-apple-darwin10 %s -filetype=obj -o %t.o 6// RUN: macho-dump --dump-section-data < %t.o > %t.dump 7// RUN: FileCheck --check-prefix=CHECK-X86_64 < %t.dump %s 8 9.data 10 11 .long 0 12a: 13 .long 0 14b = a 15 16c: .long b 17 18d2 = d 19.globl d2 20d3 = d + 4 21.globl d3 22 23e = a + 4 24 25g: 26f = g 27 .long 0 28 29 .long b 30 .long e 31 .long a + 4 32 .long d 33 .long d2 34 .long d3 35 .long f 36 .long g 37 38/// 39 .text 40t0: 41Lt0_a: 42 ret 43 44 .data 45Lt0_b: 46Lt0_x = Lt0_a - Lt0_b 47 .quad Lt0_x 48 49// CHECK-I386: ('cputype', 7) 50// CHECK-I386: ('cpusubtype', 3) 51// CHECK-I386: ('filetype', 1) 52// CHECK-I386: ('num_load_commands', 3) 53// CHECK-I386: ('load_commands_size', 296) 54// CHECK-I386: ('flag', 0) 55// CHECK-I386: ('load_commands', [ 56// CHECK-I386: # Load Command 0 57// CHECK-I386: (('command', 1) 58// CHECK-I386: ('size', 192) 59// CHECK-I386: ('segment_name', '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') 60// CHECK-I386: ('vm_addr', 0) 61// CHECK-I386: ('vm_size', 57) 62// CHECK-I386: ('file_offset', 324) 63// CHECK-I386: ('file_size', 57) 64// CHECK-I386: ('maxprot', 7) 65// CHECK-I386: ('initprot', 7) 66// CHECK-I386: ('num_sections', 2) 67// CHECK-I386: ('flags', 0) 68// CHECK-I386: ('sections', [ 69// CHECK-I386: # Section 0 70// CHECK-I386: (('section_name', '__text\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') 71// CHECK-I386: ('segment_name', '__TEXT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') 72// CHECK-I386: ('address', 0) 73// CHECK-I386: ('size', 1) 74// CHECK-I386: ('offset', 324) 75// CHECK-I386: ('alignment', 0) 76// CHECK-I386: ('reloc_offset', 0) 77// CHECK-I386: ('num_reloc', 0) 78// CHECK-I386: ('flags', 0x80000400) 79// CHECK-I386: ('reserved1', 0) 80// CHECK-I386: ('reserved2', 0) 81// CHECK-I386: ), 82// CHECK-I386: ('_relocations', [ 83// CHECK-I386: ]) 84// CHECK-I386: ('_section_data', 'c3') 85// CHECK-I386: # Section 1 86// CHECK-I386: (('section_name', '__data\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') 87// CHECK-I386: ('segment_name', '__DATA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') 88// CHECK-I386: ('address', 1) 89// CHECK-I386: ('size', 56) 90// CHECK-I386: ('offset', 325) 91// CHECK-I386: ('alignment', 0) 92// CHECK-I386: ('reloc_offset', 384) 93// CHECK-I386: ('num_reloc', 9) 94// CHECK-I386: ('flags', 0x0) 95// CHECK-I386: ('reserved1', 0) 96// CHECK-I386: ('reserved2', 0) 97// CHECK-I386: ), 98// CHECK-I386: ('_relocations', [ 99// CHECK-I386: # Relocation 0 100// CHECK-I386: (('word-0', 0x2c), 101// CHECK-I386: ('word-1', 0x4000002)), 102// CHECK-I386: # Relocation 1 103// CHECK-I386: (('word-0', 0x28), 104// CHECK-I386: ('word-1', 0x4000002)), 105// CHECK-I386: # Relocation 2 106// CHECK-I386: (('word-0', 0x24), 107// CHECK-I386: ('word-1', 0xc000009)), 108// CHECK-I386: # Relocation 3 109// CHECK-I386: (('word-0', 0x20), 110// CHECK-I386: ('word-1', 0xc000008)), 111// CHECK-I386: # Relocation 4 112// CHECK-I386: (('word-0', 0x1c), 113// CHECK-I386: ('word-1', 0xc000007)), 114// CHECK-I386: # Relocation 5 115// CHECK-I386: (('word-0', 0xa0000018), 116// CHECK-I386: ('word-1', 0x5)), 117// CHECK-I386: # Relocation 6 118// CHECK-I386: (('word-0', 0x14), 119// CHECK-I386: ('word-1', 0x4000002)), 120// CHECK-I386: # Relocation 7 121// CHECK-I386: (('word-0', 0x10), 122// CHECK-I386: ('word-1', 0x4000002)), 123// CHECK-I386: # Relocation 8 124// CHECK-I386: (('word-0', 0x8), 125// CHECK-I386: ('word-1', 0x4000002)), 126// CHECK-I386: ]) 127// CHECK-I386: ('_section_data', '00000000 00000000 05000000 00000000 05000000 09000000 09000000 00000000 00000000 00000000 0d000000 0d000000 cfffffff ffffffff') 128// CHECK-I386: ]) 129// CHECK-I386: ), 130// CHECK-I386: # Load Command 1 131// CHECK-I386: (('command', 2) 132// CHECK-I386: ('size', 24) 133// CHECK-I386: ('symoff', 456) 134// CHECK-I386: ('nsyms', 10) 135// CHECK-I386: ('stroff', 576) 136// CHECK-I386: ('strsize', 24) 137// CHECK-I386: ('_string_data', '\x00d2\x00d\x00d3\x00a\x00b\x00c\x00e\x00g\x00f\x00t0\x00') 138// CHECK-I386: ('_symbols', [ 139// CHECK-I386: # Symbol 0 140// CHECK-I386: (('n_strx', 9) 141// CHECK-I386: ('n_type', 0xe) 142// CHECK-I386: ('n_sect', 2) 143// CHECK-I386: ('n_desc', 0) 144// CHECK-I386: ('n_value', 5) 145// CHECK-I386: ('_string', 'a') 146// CHECK-I386: ), 147// CHECK-I386: # Symbol 1 148// CHECK-I386: (('n_strx', 11) 149// CHECK-I386: ('n_type', 0xe) 150// CHECK-I386: ('n_sect', 2) 151// CHECK-I386: ('n_desc', 0) 152// CHECK-I386: ('n_value', 5) 153// CHECK-I386: ('_string', 'b') 154// CHECK-I386: ), 155// CHECK-I386: # Symbol 2 156// CHECK-I386: (('n_strx', 13) 157// CHECK-I386: ('n_type', 0xe) 158// CHECK-I386: ('n_sect', 2) 159// CHECK-I386: ('n_desc', 0) 160// CHECK-I386: ('n_value', 9) 161// CHECK-I386: ('_string', 'c') 162// CHECK-I386: ), 163// CHECK-I386: # Symbol 3 164// CHECK-I386: (('n_strx', 15) 165// CHECK-I386: ('n_type', 0xe) 166// CHECK-I386: ('n_sect', 2) 167// CHECK-I386: ('n_desc', 0) 168// CHECK-I386: ('n_value', 9) 169// CHECK-I386: ('_string', 'e') 170// CHECK-I386: ), 171// CHECK-I386: # Symbol 4 172// CHECK-I386: (('n_strx', 17) 173// CHECK-I386: ('n_type', 0xe) 174// CHECK-I386: ('n_sect', 2) 175// CHECK-I386: ('n_desc', 0) 176// CHECK-I386: ('n_value', 13) 177// CHECK-I386: ('_string', 'g') 178// CHECK-I386: ), 179// CHECK-I386: # Symbol 5 180// CHECK-I386: (('n_strx', 19) 181// CHECK-I386: ('n_type', 0xe) 182// CHECK-I386: ('n_sect', 2) 183// CHECK-I386: ('n_desc', 0) 184// CHECK-I386: ('n_value', 13) 185// CHECK-I386: ('_string', 'f') 186// CHECK-I386: ), 187// CHECK-I386: # Symbol 6 188// CHECK-I386: (('n_strx', 21) 189// CHECK-I386: ('n_type', 0xe) 190// CHECK-I386: ('n_sect', 1) 191// CHECK-I386: ('n_desc', 0) 192// CHECK-I386: ('n_value', 0) 193// CHECK-I386: ('_string', 't0') 194// CHECK-I386: ), 195// CHECK-I386: # Symbol 7 196// CHECK-I386: (('n_strx', 4) 197// CHECK-I386: ('n_type', 0x1) 198// CHECK-I386: ('n_sect', 0) 199// CHECK-I386: ('n_desc', 0) 200// CHECK-I386: ('n_value', 0) 201// CHECK-I386: ('_string', 'd') 202// CHECK-I386: ), 203// CHECK-I386: # Symbol 8 204// CHECK-I386: (('n_strx', 1) 205// CHECK-I386: ('n_type', 0x1) 206// CHECK-I386: ('n_sect', 0) 207// CHECK-I386: ('n_desc', 0) 208// CHECK-I386: ('n_value', 0) 209// CHECK-I386: ('_string', 'd2') 210// CHECK-I386: ), 211// CHECK-I386: # Symbol 9 212// CHECK-I386: (('n_strx', 6) 213// CHECK-I386: ('n_type', 0x1) 214// CHECK-I386: ('n_sect', 0) 215// CHECK-I386: ('n_desc', 0) 216// CHECK-I386: ('n_value', 0) 217// CHECK-I386: ('_string', 'd3') 218// CHECK-I386: ), 219// CHECK-I386: ]) 220// CHECK-I386: ), 221// CHECK-I386: # Load Command 2 222// CHECK-I386: (('command', 11) 223// CHECK-I386: ('size', 80) 224// CHECK-I386: ('ilocalsym', 0) 225// CHECK-I386: ('nlocalsym', 7) 226// CHECK-I386: ('iextdefsym', 7) 227// CHECK-I386: ('nextdefsym', 0) 228// CHECK-I386: ('iundefsym', 7) 229// CHECK-I386: ('nundefsym', 3) 230// CHECK-I386: ('tocoff', 0) 231// CHECK-I386: ('ntoc', 0) 232// CHECK-I386: ('modtaboff', 0) 233// CHECK-I386: ('nmodtab', 0) 234// CHECK-I386: ('extrefsymoff', 0) 235// CHECK-I386: ('nextrefsyms', 0) 236// CHECK-I386: ('indirectsymoff', 0) 237// CHECK-I386: ('nindirectsyms', 0) 238// CHECK-I386: ('extreloff', 0) 239// CHECK-I386: ('nextrel', 0) 240// CHECK-I386: ('locreloff', 0) 241// CHECK-I386: ('nlocrel', 0) 242// CHECK-I386: ('_indirect_symbols', [ 243// CHECK-I386: ]) 244// CHECK-I386: ), 245// CHECK-I386: ]) 246 247// CHECK-X86_64: ('cputype', 16777223) 248// CHECK-X86_64: ('cpusubtype', 3) 249// CHECK-X86_64: ('filetype', 1) 250// CHECK-X86_64: ('num_load_commands', 3) 251// CHECK-X86_64: ('load_commands_size', 336) 252// CHECK-X86_64: ('flag', 0) 253// CHECK-X86_64: ('reserved', 0) 254// CHECK-X86_64: ('load_commands', [ 255// CHECK-X86_64: # Load Command 0 256// CHECK-X86_64: (('command', 25) 257// CHECK-X86_64: ('size', 232) 258// CHECK-X86_64: ('segment_name', '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') 259// CHECK-X86_64: ('vm_addr', 0) 260// CHECK-X86_64: ('vm_size', 57) 261// CHECK-X86_64: ('file_offset', 368) 262// CHECK-X86_64: ('file_size', 57) 263// CHECK-X86_64: ('maxprot', 7) 264// CHECK-X86_64: ('initprot', 7) 265// CHECK-X86_64: ('num_sections', 2) 266// CHECK-X86_64: ('flags', 0) 267// CHECK-X86_64: ('sections', [ 268// CHECK-X86_64: # Section 0 269// CHECK-X86_64: (('section_name', '__text\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') 270// CHECK-X86_64: ('segment_name', '__TEXT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') 271// CHECK-X86_64: ('address', 0) 272// CHECK-X86_64: ('size', 1) 273// CHECK-X86_64: ('offset', 368) 274// CHECK-X86_64: ('alignment', 0) 275// CHECK-X86_64: ('reloc_offset', 0) 276// CHECK-X86_64: ('num_reloc', 0) 277// CHECK-X86_64: ('flags', 0x80000400) 278// CHECK-X86_64: ('reserved1', 0) 279// CHECK-X86_64: ('reserved2', 0) 280// CHECK-X86_64: ('reserved3', 0) 281// CHECK-X86_64: ), 282// CHECK-X86_64: ('_relocations', [ 283// CHECK-X86_64: ]) 284// CHECK-X86_64: ('_section_data', 'c3') 285// CHECK-X86_64: # Section 1 286// CHECK-X86_64: (('section_name', '__data\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') 287// CHECK-X86_64: ('segment_name', '__DATA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') 288// CHECK-X86_64: ('address', 1) 289// CHECK-X86_64: ('size', 56) 290// CHECK-X86_64: ('offset', 369) 291// CHECK-X86_64: ('alignment', 0) 292// CHECK-X86_64: ('reloc_offset', 428) 293// CHECK-X86_64: ('num_reloc', 9) 294// CHECK-X86_64: ('flags', 0x0) 295// CHECK-X86_64: ('reserved1', 0) 296// CHECK-X86_64: ('reserved2', 0) 297// CHECK-X86_64: ('reserved3', 0) 298// CHECK-X86_64: ), 299// CHECK-X86_64: ('_relocations', [ 300// CHECK-X86_64: # Relocation 0 301// CHECK-X86_64: (('word-0', 0x2c), 302// CHECK-X86_64: ('word-1', 0xc000004)), 303// CHECK-X86_64: # Relocation 1 304// CHECK-X86_64: (('word-0', 0x28), 305// CHECK-X86_64: ('word-1', 0xc000005)), 306// CHECK-X86_64: # Relocation 2 307// CHECK-X86_64: (('word-0', 0x24), 308// CHECK-X86_64: ('word-1', 0xc000009)), 309// CHECK-X86_64: # Relocation 3 310// CHECK-X86_64: (('word-0', 0x20), 311// CHECK-X86_64: ('word-1', 0xc000008)), 312// CHECK-X86_64: # Relocation 4 313// CHECK-X86_64: (('word-0', 0x1c), 314// CHECK-X86_64: ('word-1', 0xc000007)), 315// CHECK-X86_64: # Relocation 5 316// CHECK-X86_64: (('word-0', 0x18), 317// CHECK-X86_64: ('word-1', 0xc000000)), 318// CHECK-X86_64: # Relocation 6 319// CHECK-X86_64: (('word-0', 0x14), 320// CHECK-X86_64: ('word-1', 0xc000003)), 321// CHECK-X86_64: # Relocation 7 322// CHECK-X86_64: (('word-0', 0x10), 323// CHECK-X86_64: ('word-1', 0xc000001)), 324// CHECK-X86_64: # Relocation 8 325// CHECK-X86_64: (('word-0', 0x8), 326// CHECK-X86_64: ('word-1', 0xc000001)), 327// CHECK-X86_64: ]) 328// CHECK-X86_64: ('_section_data', '00000000 00000000 00000000 00000000 00000000 00000000 04000000 00000000 00000000 00000000 00000000 00000000 cfffffff ffffffff') 329// CHECK-X86_64: ]) 330// CHECK-X86_64: ), 331// CHECK-X86_64: # Load Command 1 332// CHECK-X86_64: (('command', 2) 333// CHECK-X86_64: ('size', 24) 334// CHECK-X86_64: ('symoff', 500) 335// CHECK-X86_64: ('nsyms', 10) 336// CHECK-X86_64: ('stroff', 660) 337// CHECK-X86_64: ('strsize', 24) 338// CHECK-X86_64: ('_string_data', '\x00d2\x00d\x00d3\x00a\x00b\x00c\x00e\x00g\x00f\x00t0\x00') 339// CHECK-X86_64: ('_symbols', [ 340// CHECK-X86_64: # Symbol 0 341// CHECK-X86_64: (('n_strx', 9) 342// CHECK-X86_64: ('n_type', 0xe) 343// CHECK-X86_64: ('n_sect', 2) 344// CHECK-X86_64: ('n_desc', 0) 345// CHECK-X86_64: ('n_value', 5) 346// CHECK-X86_64: ('_string', 'a') 347// CHECK-X86_64: ), 348// CHECK-X86_64: # Symbol 1 349// CHECK-X86_64: (('n_strx', 11) 350// CHECK-X86_64: ('n_type', 0xe) 351// CHECK-X86_64: ('n_sect', 2) 352// CHECK-X86_64: ('n_desc', 0) 353// CHECK-X86_64: ('n_value', 5) 354// CHECK-X86_64: ('_string', 'b') 355// CHECK-X86_64: ), 356// CHECK-X86_64: # Symbol 2 357// CHECK-X86_64: (('n_strx', 13) 358// CHECK-X86_64: ('n_type', 0xe) 359// CHECK-X86_64: ('n_sect', 2) 360// CHECK-X86_64: ('n_desc', 0) 361// CHECK-X86_64: ('n_value', 9) 362// CHECK-X86_64: ('_string', 'c') 363// CHECK-X86_64: ), 364// CHECK-X86_64: # Symbol 3 365// CHECK-X86_64: (('n_strx', 15) 366// CHECK-X86_64: ('n_type', 0xe) 367// CHECK-X86_64: ('n_sect', 2) 368// CHECK-X86_64: ('n_desc', 0) 369// CHECK-X86_64: ('n_value', 9) 370// CHECK-X86_64: ('_string', 'e') 371// CHECK-X86_64: ), 372// CHECK-X86_64: # Symbol 4 373// CHECK-X86_64: (('n_strx', 17) 374// CHECK-X86_64: ('n_type', 0xe) 375// CHECK-X86_64: ('n_sect', 2) 376// CHECK-X86_64: ('n_desc', 0) 377// CHECK-X86_64: ('n_value', 13) 378// CHECK-X86_64: ('_string', 'g') 379// CHECK-X86_64: ), 380// CHECK-X86_64: # Symbol 5 381// CHECK-X86_64: (('n_strx', 19) 382// CHECK-X86_64: ('n_type', 0xe) 383// CHECK-X86_64: ('n_sect', 2) 384// CHECK-X86_64: ('n_desc', 0) 385// CHECK-X86_64: ('n_value', 13) 386// CHECK-X86_64: ('_string', 'f') 387// CHECK-X86_64: ), 388// CHECK-X86_64: # Symbol 6 389// CHECK-X86_64: (('n_strx', 21) 390// CHECK-X86_64: ('n_type', 0xe) 391// CHECK-X86_64: ('n_sect', 1) 392// CHECK-X86_64: ('n_desc', 0) 393// CHECK-X86_64: ('n_value', 0) 394// CHECK-X86_64: ('_string', 't0') 395// CHECK-X86_64: ), 396// CHECK-X86_64: # Symbol 7 397// CHECK-X86_64: (('n_strx', 4) 398// CHECK-X86_64: ('n_type', 0x1) 399// CHECK-X86_64: ('n_sect', 0) 400// CHECK-X86_64: ('n_desc', 0) 401// CHECK-X86_64: ('n_value', 0) 402// CHECK-X86_64: ('_string', 'd') 403// CHECK-X86_64: ), 404// CHECK-X86_64: # Symbol 8 405// CHECK-X86_64: (('n_strx', 1) 406// CHECK-X86_64: ('n_type', 0x1) 407// CHECK-X86_64: ('n_sect', 0) 408// CHECK-X86_64: ('n_desc', 0) 409// CHECK-X86_64: ('n_value', 0) 410// CHECK-X86_64: ('_string', 'd2') 411// CHECK-X86_64: ), 412// CHECK-X86_64: # Symbol 9 413// CHECK-X86_64: (('n_strx', 6) 414// CHECK-X86_64: ('n_type', 0x1) 415// CHECK-X86_64: ('n_sect', 0) 416// CHECK-X86_64: ('n_desc', 0) 417// CHECK-X86_64: ('n_value', 0) 418// CHECK-X86_64: ('_string', 'd3') 419// CHECK-X86_64: ), 420// CHECK-X86_64: ]) 421// CHECK-X86_64: ), 422// CHECK-X86_64: # Load Command 2 423// CHECK-X86_64: (('command', 11) 424// CHECK-X86_64: ('size', 80) 425// CHECK-X86_64: ('ilocalsym', 0) 426// CHECK-X86_64: ('nlocalsym', 7) 427// CHECK-X86_64: ('iextdefsym', 7) 428// CHECK-X86_64: ('nextdefsym', 0) 429// CHECK-X86_64: ('iundefsym', 7) 430// CHECK-X86_64: ('nundefsym', 3) 431// CHECK-X86_64: ('tocoff', 0) 432// CHECK-X86_64: ('ntoc', 0) 433// CHECK-X86_64: ('modtaboff', 0) 434// CHECK-X86_64: ('nmodtab', 0) 435// CHECK-X86_64: ('extrefsymoff', 0) 436// CHECK-X86_64: ('nextrefsyms', 0) 437// CHECK-X86_64: ('indirectsymoff', 0) 438// CHECK-X86_64: ('nindirectsyms', 0) 439// CHECK-X86_64: ('extreloff', 0) 440// CHECK-X86_64: ('nextrel', 0) 441// CHECK-X86_64: ('locreloff', 0) 442// CHECK-X86_64: ('nlocrel', 0) 443// CHECK-X86_64: ('_indirect_symbols', [ 444// CHECK-X86_64: ]) 445// CHECK-X86_64: ), 446// CHECK-X86_64: ]) 447