[MCJIT] Make MCJIT honor symbol visibility settings when populating the global
[oota-llvm.git] / test / ExecutionEngine / RuntimeDyld / ARM / MachO_ARM_PIC_relocations.s
1 # RUN: llvm-mc -triple=armv7s-apple-ios7.0.0 -relocation-model=pic -filetype=obj -o %T/foo.o %s
2 # RUN: llvm-rtdyld -triple=armv7s-apple-ios7.0.0 -verify -check=%s %/T/foo.o
3
4         .syntax unified
5         .section        __TEXT,__text,regular,pure_instructions
6         .globl  bar
7         .align  2
8 bar:
9 # Check lower 16-bits of section difference relocation
10 # rtdyld-check: decode_operand(insn1, 1) = (foo$non_lazy_ptr-(nextPC+8))[15:0]
11         .globl  insn1
12 insn1:
13         movw    r0, :lower16:(foo$non_lazy_ptr-(nextPC+8))
14 # Check upper 16-bits of section difference relocation
15 # rtdyld-check: decode_operand(insn2, 2) = (foo$non_lazy_ptr-(nextPC+8))[31:16]
16         .globl  insn2
17 insn2:
18         movt    r0, :upper16:(foo$non_lazy_ptr-(nextPC+8))
19         .globl  nextPC
20 nextPC:
21         add     r1, r0, r0
22
23 # Check stub generation for external symbols by referencing a common symbol, 'baz'.
24 # Check both the content of the stub, and the reference to the stub.
25 # Stub should contain '0xe51ff004' (ldr pc, [pc, #-4]), followed by the target.
26 #
27 # rtdyld-check: *{4}(stub_addr(foo.o, __text, baz)) = 0xe51ff004
28 # rtdyld-check: *{4}(stub_addr(foo.o, __text, baz) + 4) = baz
29 #
30 # rtdyld-check: decode_operand(insn3, 0) = stub_addr(foo.o, __text, baz) - (insn3 + 8)
31         .globl  insn3
32 insn3:
33         bl      baz
34
35 # Check stub generation for internal symbols by referencing 'bar'.
36 # rtdyld-check: *{4}(stub_addr(foo.o, __text, bar) + 4) = bar
37 insn4:
38         bl      bar
39         bx      lr
40
41 # Add 'aaa' to the common symbols to make sure 'baz' isn't at the start of the
42 # section. This ensures that we test VANILLA relocation addends correctly.
43         .comm   aaa, 4, 2
44         .comm   baz, 4, 2
45         .comm   foo, 4, 2
46
47 # Check that the symbol pointer section entries are fixed up properly:
48 # rtdyld-check: *{4}foo$non_lazy_ptr = foo
49         .section        __DATA,__nl_symbol_ptr,non_lazy_symbol_pointers
50         .align  2
51         .globl  foo$non_lazy_ptr
52 foo$non_lazy_ptr:
53         .indirect_symbol        foo
54         .long   0
55
56 .subsections_via_symbols