xref: /llvm-project/llvm/test/ExecutionEngine/JITLink/x86-64/Inputs/MachO_self_relocation.s (revision 8ad75c1037289b06bd1b95ff445797d380d93039)
1 .section  __TEXT,__text,regular,pure_instructions
2
3  .globl  _form_func_ptr
4_form_func_ptr:
5  leaq  _form_func_ptr(%rip), %rax
6  leaq  _other(%rip), %rax
7  leaq  _form_func_ptr(%rip), %rax
8  nop
9  leaq  _form_func_ptr(%rip), %rax
10  retq
11
12  .globl  _other
13_other:
14  leaq  _form_func_ptr(%rip), %rax
15  retq
16
17# Return 0 if the pointers formed inside and outside the function are the same.
18  .globl _main
19_main:
20  pushq %rbp
21  movq  %rsp, %rbp
22  subq  $32, %rsp
23  movl  $0, -4(%rbp)
24  callq _form_func_ptr
25  movq  %rax, -16(%rbp)
26  callq _other
27  movq  %rax, -24(%rbp)
28  movq  -16(%rbp), %rax
29  cmpq  -24(%rbp), %rax
30  setne  %al
31  andb  $1, %al
32  movzbl  %al, %eax
33  addq  $32, %rsp
34  popq  %rbp
35  retq
36
37  .subsections_via_symbols
38