1// RUN: llvm-mc -triple x86_64-apple-darwin9 %s -filetype=obj -o - | macho-dump --dump-section-data | FileCheck %s
2
3// Test case for rdar://9356266
4
5// This tests that this expression does not cause a crash and produces these
6// four relocation entries:
7// Relocation information (__DATA,__data) 4 entries
8// address  pcrel length extern type    scattered symbolnum/value
9// 00000004 False long   False  SUB     False     2 (__DATA,__data)
10// 00000004 False long   False  UNSIGND False     2 (__DATA,__data)
11// 00000000 False long   False  SUB     False     2 (__DATA,__data)
12// 00000000 False long   False  UNSIGND False     2 (__DATA,__data)
13
14	.data
15L_var1:
16L_var2:
17// This was working fine
18	.long L_var2 - L_var1
19
20	.set L_var3, .
21	.set L_var4, .
22// But this was causing a crash
23	.long L_var4 - L_var3
24
25// CHECK:  ('_relocations', [
26// CHECK:    # Relocation 0
27// CHECK:    (('word-0', 0x4),
28// CHECK:     ('word-1', 0x54000002)),
29// CHECK:    # Relocation 1
30// CHECK:    (('word-0', 0x4),
31// CHECK:     ('word-1', 0x4000002)),
32// CHECK:    # Relocation 2
33// CHECK:    (('word-0', 0x0),
34// CHECK:     ('word-1', 0x54000002)),
35// CHECK:    # Relocation 3
36// CHECK:    (('word-0', 0x0),
37// CHECK:     ('word-1', 0x4000002)),
38// CHECK:  ])
39