File tree 3 files changed +139
-0
lines changed
llvm/test/ExecutionEngine/JITLink/ppc64
3 files changed +139
-0
lines changed Original file line number Diff line number Diff line change
1
+ # This module contains a function with its local and global entry points
2
+ # exposed. It is used by the ppc64_elf test to verify that functions with
3
+ # different TOCs are called via their global entry points.
4
+ .text
5
+ .abiversion 2
6
+ .file "ppc64_elf_module_b.ll"
7
+ .section .rodata.cst4,"aM" ,@progbits ,4
8
+ .p2align 2 # -- Begin function foo
9
+ .LCPI0_0:
10
+ .long 1093664768 # float 11
11
+ .text
12
+ .globl foo
13
+ .p2align 4
14
+ .type foo,@function
15
+ .Lfunc_toc0: # @foo
16
+ .quad .TOC.-foo_gep
17
+ foo:
18
+ .Lfunc_begin0:
19
+ .cfi_startproc
20
+ .globl foo_gep
21
+ foo_gep:
22
+ ld 2 , .Lfunc_toc0-foo_gep(12 )
23
+ add 2 , 2 , 12
24
+ .globl foo_lep
25
+ foo_lep:
26
+ .localentry foo, foo_lep-foo_gep
27
+ # %bb.0:
28
+ addis 3 , 2 , .LC0@toc@ha
29
+ ld 3 , .LC0@toc@l(3 )
30
+ lfsx 1 , 0 , 3
31
+ blr
32
+ .long 0
33
+ .quad 0
34
+ .Lfunc_end0:
35
+ .size foo, .Lfunc_end0-.Lfunc_begin0
36
+ .cfi_endproc
37
+ # -- End function
38
+ .section .toc,"aw" ,@progbits
39
+ .LC0:
40
+ .tc .LCPI0_0[TC],.LCPI0_0
41
+
42
+ .section ".note.GNU-stack" ,"",@progbits
Original file line number Diff line number Diff line change
1
+ # RUN: rm -rf %t && mkdir -p %t
2
+ # RUN: llvm-mc -triple=powerpc64le-unknown-linux-gnu -filetype=obj -o %t/ppc64_elf.o %s
3
+ # RUN: llvm-mc -triple=powerpc64le-unknown-linux-gnu -filetype=obj -o %t/ppc64_elf_module_b.o %S/Inputs/ppc64_elf_module_b.s
4
+ # RUN: llvm-jitlink -noexec -check %s %t/ppc64_elf.o %t/ppc64_elf_module_b.o
5
+ .text
6
+ .abiversion 2
7
+ .file "Module2.ll"
8
+ .global main
9
+ .p2align 4
10
+ .type main,@function
11
+ main:
12
+ li 3 , 0
13
+ blr
14
+ .size main, .-main
15
+
16
+ .globl bar # -- Begin function bar
17
+ .p2align 4
18
+ .type bar,@function
19
+ .Lfunc_toc0: # @bar
20
+ .quad .TOC.-.Lfunc_gep0
21
+ bar:
22
+ .Lfunc_begin0:
23
+ .Lfunc_gep0:
24
+ ld 2 , .Lfunc_toc0-.Lfunc_gep0(12 )
25
+ add 2 , 2 , 12
26
+ .Lfunc_lep0:
27
+ .localentry bar, .Lfunc_lep0-.Lfunc_gep0
28
+ # %bb.0:
29
+ mflr 0
30
+ std 0 , 16 (1 )
31
+ stdu 1 , -32 (1 )
32
+ # jitlink-check: (*{8}got_addr(ppc64_elf.o, foo)) = foo_gep
33
+ # jitlink-check: decode_operand(bar+20, 0) = (stub_addr(ppc64_elf.o, foo) - (bar+20)) >> 2
34
+ foo_call:
35
+ bl foo
36
+ nop
37
+ addi 1 , 1 , 32
38
+ ld 0 , 16 (1 )
39
+ mtlr 0
40
+ blr
41
+ .long 0
42
+ .quad 0
43
+ .Lfunc_end0:
44
+ .size bar, .Lfunc_end0-.Lfunc_begin0
45
+ # -- End function
46
+
47
+ .section ".note.GNU-stack" ,"",@progbits
Original file line number Diff line number Diff line change
1
+ # RUN: rm -rf %t && mkdir -p %t
2
+ # RUN: llvm-mc -triple=powerpc64le-unknown-linux-gnu -filetype=obj -o %t/ppc64_reloc.o %s
3
+ # RUN: llvm-mc -triple=powerpc64le-unknown-linux-gnu -filetype=obj -o %t/ppc64_elf_module_b.o %S/Inputs/ppc64_elf_module_b.s
4
+ # RUN: llvm-jitlink -noexec -check %s %t/ppc64_reloc.o %t/ppc64_elf_module_b.o
5
+
6
+ .text
7
+ .abiversion 2
8
+ .file "test.c"
9
+ .globl main
10
+ .p2align 4
11
+ .type main,@function
12
+ main:
13
+ li 3 , 0
14
+ blr
15
+ .size main, .-main
16
+
17
+ .globl func
18
+ .p2align 4
19
+ .type func,@function
20
+ func: # @func
21
+ .Lfunc_begin0:
22
+ .Lfunc_gep0:
23
+ addis 2 , 12 , .TOC.-.Lfunc_gep0@ha
24
+ addi 2 , 2 , .TOC.-.Lfunc_gep0@l
25
+ .Lfunc_lep0:
26
+ .localentry func, .Lfunc_lep0-.Lfunc_gep0
27
+ mflr 0
28
+ std 31 , -8 (1 )
29
+ std 0 , 16 (1 )
30
+ stdu 1 , -112 (1 )
31
+ mr 31 , 1
32
+ # confirm that LK flag is set for bl
33
+ # jitlink-check: (*{4}(func+28)) & 1 = 1
34
+ call_bl:
35
+ bl foo
36
+ nop
37
+ li 3 , 0
38
+ addi 1 , 1 , 112
39
+ ld 0 , 16 (1 )
40
+ ld 31 , -8 (1 )
41
+ mtlr 0
42
+ # confirm that LK flag is not set for b
43
+ # jitlink-check: (*{4}(func+56)) & 1 = 0
44
+ call_b:
45
+ b foo
46
+ nop
47
+ .long 0
48
+ .quad 0
49
+ .Lfunc_end0:
50
+ .size func, .Lfunc_end0-.Lfunc_begin0
You can’t perform that action at this time.
0 commit comments