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