1# RUN: llvm-mc -triple=i386-apple-macosx10.4 -filetype=obj -o %T/test_i386.o %s
2# RUN: llvm-rtdyld -triple=i386-apple-macosx10.4 -verify -check=%s %/T/test_i386.o
3
4// Put the section used in the test at a non zero address.
5	.long 4
6
7	.section	__TEXT,__text2,regular,pure_instructions
8	.globl	bar
9	.align	4, 0x90
10bar:
11	calll	tmp0$pb
12tmp0$pb:
13	popl	%eax
14# Test section difference relocation to non-lazy ptr section.
15# rtdyld-check: decode_operand(inst1, 4) = x$non_lazy_ptr - tmp0$pb + 8
16inst1:
17	movl	(x$non_lazy_ptr-tmp0$pb)+8(%eax), %eax
18        movl    (%eax), %ebx
19
20# Test VANILLA relocation to jump table.
21# rtdyld-check: decode_operand(inst2, 0) = bling$stub - next_pc(inst2)
22inst2:
23        calll	bling$stub
24        addl    %ebx, %eax
25
26# Test scattered VANILLA relocations.
27inst3:
28        movl    y+4, %ecx
29        addl    %ecx, %eax
30	retl
31
32	.section	__IMPORT,__jump_table,symbol_stubs,pure_instructions+self_modifying_code,5
33bling$stub:
34	.indirect_symbol	bling
35	.ascii	"\364\364\364\364\364"
36
37	.section	__IMPORT,__pointers,non_lazy_symbol_pointers
38x$non_lazy_ptr:
39	.indirect_symbol	x
40	.long	0
41
42        .comm   x,4,2
43        .comm   bling,4,2
44
45        .globl	y
46.zerofill __DATA,__common,y,8,3
47
48.subsections_via_symbols
49