aboutsummaryrefslogtreecommitdiffstats
path: root/test/MC/MachO/darwin-x86_64-diff-reloc-assign-2.s
blob: 5d548790a7a9569628b482c08204eafa0ead01c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// RUN: llvm-mc -triple x86_64-apple-darwin9 %s -filetype=obj -o - | macho-dump --dump-section-data | FileCheck %s

// Test case for rdar://9356266

// This tests that this expression does not cause a crash and produces these
// four relocation entries:
// Relocation information (__DATA,__data) 4 entries
// address  pcrel length extern type    scattered symbolnum/value
// 00000004 False long   False  SUB     False     2 (__DATA,__data)
// 00000004 False long   False  UNSIGND False     2 (__DATA,__data)
// 00000000 False long   False  SUB     False     2 (__DATA,__data)
// 00000000 False long   False  UNSIGND False     2 (__DATA,__data)

	.data
L_var1:
L_var2:
// This was working fine
	.long L_var2 - L_var1
	
	.set L_var3, .
	.set L_var4, .
// But this was causing a crash
	.long L_var4 - L_var3

// CHECK:  ('_relocations', [
// CHECK:    # Relocation 0
// CHECK:    (('word-0', 0x4),
// CHECK:     ('word-1', 0x54000002)),
// CHECK:    # Relocation 1
// CHECK:    (('word-0', 0x4),
// CHECK:     ('word-1', 0x4000002)),
// CHECK:    # Relocation 2
// CHECK:    (('word-0', 0x0),
// CHECK:     ('word-1', 0x54000002)),
// CHECK:    # Relocation 3
// CHECK:    (('word-0', 0x0),
// CHECK:     ('word-1', 0x4000002)),
// CHECK:  ])