Fix a Mach-O assembler segfault for a subtraction expression with an undefined symbol.
[oota-llvm.git] / test / MC / MachO / i386-large-relocations.s
1 // RUN: llvm-mc -triple i386-apple-darwin10 %s -filetype=obj -o - | macho-dump | FileCheck %s
2
3 .space 0x1ed280
4        .section        __DATA,__const
5        .align  4
6 .space 0x5181020
7 _foo:
8        .long   _bar
9        .long   0
10        .long   _bar+8
11        .long   _bar+24
12        .long   0
13        .long   _bar+16
14
15 .zerofill __DATA,__bss,__dummy,0x5d780
16 .zerofill __DATA,__bss,_bar,48,4
17
18 // Normally scattered relocations are used for sym+offset expressions. When
19 // the value exceeds 24-bits, however, it's outside what MachO can encode,
20 // so the assembler falls back to non-scattered relocations.
21 // rdar://12358909
22
23 // CHECK: ('_relocations', [
24 // CHECK:   # Relocation 0
25 // CHECK:   (('word-0', 0x5181034),
26 // CHECK:    ('word-1', 0x4000003)),
27 // CHECK:   # Relocation 1
28 // CHECK:   (('word-0', 0x518102c),
29 // CHECK:    ('word-1', 0x4000003)),
30 // CHECK:   # Relocation 2
31 // CHECK:   (('word-0', 0x5181028),
32 // CHECK:    ('word-1', 0x4000003)),
33 // CHECK:   # Relocation 3
34 // CHECK:   (('word-0', 0x5181020),
35 // CHECK:    ('word-1', 0x4000003)),
36 // CHECK: ])