comparison lld/test/ELF/ppc64-long-branch.s @ 150:1d019706d866

LLVM10
author anatofuz
date Thu, 13 Feb 2020 15:10:13 +0900
parents
children 0572611fdcc8
comparison
equal deleted inserted replaced
147:c2174574ed3a 150:1d019706d866
1 # REQUIRES: ppc
2 # RUN: echo 'SECTIONS { \
3 # RUN: .text_low 0x2000: { *(.text_low) } \
4 # RUN: .text_high 0x2002000 : { *(.text_high) } \
5 # RUN: }' > %t.script
6
7 # RUN: llvm-mc -filetype=obj -triple=ppc64le %s -o %t.o
8 # RUN: ld.lld -T %t.script %t.o -o %t
9 # RUN: llvm-readelf -S -r %t | FileCheck --check-prefix=SEC %s
10 # RUN: llvm-readelf -x .branch_lt %t | FileCheck --check-prefix=BRANCH-LE %s
11 # RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
12
13 # RUN: llvm-mc -filetype=obj -triple=ppc64 %s -o %t.o
14 # RUN: ld.lld -T %t.script %t.o -o %t
15 # RUN: llvm-readelf -S -r %t | FileCheck --check-prefix=SEC %s
16 # RUN: llvm-readelf -x .branch_lt %t | FileCheck --check-prefix=BRANCH-BE %s
17 # RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
18
19 # SEC: Name Type Address Off Size ES Flg Lk Inf Al
20 # SEC: .got PROGBITS 0000000002002028 2002028 000008 00 WA 0 0 8
21 # SEC: .branch_lt PROGBITS 0000000002002030 2002030 000018 00 WA 0 0 8
22
23 # SEC: There are no relocations in this file.
24
25 ## high@localentry (high+8), .text_high+16 and .text_low+8
26 # BRANCH-LE: 0x02002030 08200002 00000000 10200002 00000000
27 # BRANCH-LE-NEXT: 0x02002040 08200000 00000000
28 # BRANCH-BE: 0x02002030 00000000 02002008 00000000 02002010
29 # BRANCH-BE-NEXT: 0x02002040 00000000 00002008
30
31 # CHECK: _start:
32 # CHECK-NEXT: 2000: bl .+24
33 # CHECK-NEXT: bl .+20
34 # CHECK-NEXT: bl .+16
35 # CHECK-NEXT: bl .+33554428
36
37 ## &.branch_lt[0] - .TOC. = .branch_lt - (.got+0x8000) = -32760
38 # CHECK: __long_branch_high:
39 # CHECK-NEXT: 2018: addis 12, 2, 0
40 # CHECK-NEXT: ld 12, -32760(12)
41 # CHECK-NEXT: mtctr 12
42 # CHECK-NEXT: bctr
43
44 ## &.branch_lt[1] - .TOC. = .branch_lt - (.got+0x8000) = -32752
45 # CHECK: __long_branch_:
46 # CHECK-NEXT: 2028: addis 12, 2, 0
47 # CHECK-NEXT: ld 12, -32752(12)
48 # CHECK-NEXT: mtctr 12
49 # CHECK-NEXT: bctr
50
51 .section .text_low, "ax", %progbits
52 .globl _start
53 _start:
54 bl high # Need a thunk
55 bl high # Need a thunk
56 bl high # Need a thunk
57 bl high
58 bl .text_high+16 # Need a thunk
59 blr
60
61 # CHECK: Disassembly of section .text_high:
62 # CHECK-EMPTY:
63 # CHECK-NEXT: high:
64 # CHECK-NEXT: 2002000: addis 2, 12, 1
65 # CHECK-NEXT: addi 2, 2, -32728
66 # CHECK-NEXT: bl .-33554432
67 # CHECK-NEXT: bl .+8
68 # CHECK: __long_branch_:
69 # CHECK-NEXT: 2002014: addis 12, 2, 0
70 # CHECK-NEXT: ld 12, -32744(12)
71 # CHECK-NEXT: mtctr 12
72 # CHECK-NEXT: bctr
73
74 .section .text_high, "ax", %progbits
75 .globl high
76 high:
77 addis 2, 12, .TOC.-high@ha
78 addi 2, 2, .TOC.-high@l
79 .localentry high, 8
80 bl .text_low+8
81 bl .text_low+8 # Need a thunk
82 blr