[MCJIT] Make MCJIT honor symbol visibility settings when populating the global
[oota-llvm.git] / test / ExecutionEngine / RuntimeDyld / X86 / MachO_x86-64_PIC_relocations.s
1 # RUN: llvm-mc -triple=x86_64-apple-macosx10.9 -relocation-model=pic -filetype=obj -o %T/test_x86-64.o %s
2 # RUN: llvm-rtdyld -triple=x86_64-apple-macosx10.9 -verify -check=%s %/T/test_x86-64.o
3
4         .section        __TEXT,__text,regular,pure_instructions
5         .globl  foo
6         .align  4, 0x90
7 foo:
8         retq
9
10         .globl  main
11         .align  4, 0x90
12 main:
13 # Test PC-rel branch.
14 # rtdyld-check: decode_operand(insn1, 0) = foo - next_pc(insn1)
15         .globl  insn1
16 insn1:
17         callq   foo
18
19 # Test PC-rel signed.
20 # rtdyld-check: decode_operand(insn2, 4) = x - next_pc(insn2)
21         .globl  insn2
22 insn2:
23         movl    x(%rip), %eax
24
25 # Test PC-rel GOT relocation.
26 # Verify both the contents of the GOT entry for y, and that the movq instruction
27 # references the correct GOT entry address:
28 # rtdyld-check: *{8}(stub_addr(test_x86-64.o, __text, y)) = y
29 # rtdyld-check: decode_operand(insn3, 4) = stub_addr(test_x86-64.o, __text, y) - next_pc(insn3)
30         .globl  insn3
31 insn3:
32         movq    y@GOTPCREL(%rip), %rax
33
34         movl    $0, %eax
35         retq
36
37         .comm   y,4,2
38
39         .section        __DATA,__data
40         .globl  x
41         .align  2
42 x:
43         .long   5
44
45 .subsections_via_symbols