[RuntimeDyld] Fix MachO i386 SECTDIFF relocation to support non-zero addends.
[oota-llvm.git] / test / ExecutionEngine / RuntimeDyld / X86 / MachO_i386_DynNoPIC_relocations.s
1 # RUN: llvm-mc -triple=i386-apple-macosx10.4 -relocation-model=dynamic-no-pic -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         .section        __TEXT,__text,regular,pure_instructions
5         .globl  bar
6         .align  4, 0x90
7 bar:
8         calll   tmp0$pb
9 tmp0$pb:
10         popl    %eax
11 # Test section difference relocation to non-lazy ptr section.
12 # rtdyld-check: decode_operand(inst1, 4) = x$non_lazy_ptr - tmp0$pb + 8
13 inst1:
14         movl    (x$non_lazy_ptr-tmp0$pb)+8(%eax), %eax
15         movl    (%eax), %ebx
16
17 # Test VANILLA relocation to jump table.
18 # rtdyld-check: decode_operand(inst2, 0) = bling$stub - next_pc(inst2)
19 inst2:
20         calll   bling$stub
21         addl    %ebx, %eax
22
23 # Test scattered VANILLA relocations.
24 inst3:
25         movl    y+4, %ecx
26         addl    %ecx, %eax
27         retl
28
29         .section        __IMPORT,__jump_table,symbol_stubs,pure_instructions+self_modifying_code,5
30 bling$stub:
31         .indirect_symbol        bling
32         .ascii  "\364\364\364\364\364"
33
34         .section        __IMPORT,__pointers,non_lazy_symbol_pointers
35 x$non_lazy_ptr:
36         .indirect_symbol        x
37         .long   0
38
39         .comm   x,4,2
40         .comm   bling,4,2
41
42         .globl  y
43 .zerofill __DATA,__common,y,8,3
44
45 .subsections_via_symbols