xref: /aosp_15_r20/external/llvm/test/MC/PowerPC/ppc64-localentry.s (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker
2*9880d681SAndroid Build Coastguard Worker# RUN: llvm-mc -triple powerpc64-unknown-unknown -filetype=obj %s | \
3*9880d681SAndroid Build Coastguard Worker# RUN: llvm-readobj -h -r -symbols | FileCheck %s
4*9880d681SAndroid Build Coastguard Worker# RUN: llvm-mc -triple powerpc64le-unknown-unknown -filetype=obj %s | \
5*9880d681SAndroid Build Coastguard Worker# RUN: llvm-readobj -h -r -symbols | FileCheck %s
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Worker	.type callee1, @function
8*9880d681SAndroid Build Coastguard Workercallee1:
9*9880d681SAndroid Build Coastguard Worker	nop
10*9880d681SAndroid Build Coastguard Worker	nop
11*9880d681SAndroid Build Coastguard Worker	.localentry callee1, .-callee1
12*9880d681SAndroid Build Coastguard Worker	nop
13*9880d681SAndroid Build Coastguard Worker	nop
14*9880d681SAndroid Build Coastguard Worker	.size callee1, .-callee1
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Worker	.type callee2, @function
17*9880d681SAndroid Build Coastguard Workercallee2:
18*9880d681SAndroid Build Coastguard Worker	nop
19*9880d681SAndroid Build Coastguard Worker	nop
20*9880d681SAndroid Build Coastguard Worker	.size callee2, .-callee2
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker	.type caller, @function
23*9880d681SAndroid Build Coastguard Workercaller:
24*9880d681SAndroid Build Coastguard Worker	bl callee1
25*9880d681SAndroid Build Coastguard Worker	nop
26*9880d681SAndroid Build Coastguard Worker	bl callee2
27*9880d681SAndroid Build Coastguard Worker	nop
28*9880d681SAndroid Build Coastguard Worker	.size caller, .-caller
29*9880d681SAndroid Build Coastguard Worker
30*9880d681SAndroid Build Coastguard Worker	.section .text.other
31*9880d681SAndroid Build Coastguard Workercaller_other:
32*9880d681SAndroid Build Coastguard Worker	bl callee1
33*9880d681SAndroid Build Coastguard Worker	nop
34*9880d681SAndroid Build Coastguard Worker	bl callee2
35*9880d681SAndroid Build Coastguard Worker	nop
36*9880d681SAndroid Build Coastguard Worker	.size caller_other, .-caller_other
37*9880d681SAndroid Build Coastguard Worker
38*9880d681SAndroid Build Coastguard Workercopy1 = callee1
39*9880d681SAndroid Build Coastguard Workercopy2 = callee2
40*9880d681SAndroid Build Coastguard Worker
41*9880d681SAndroid Build Coastguard Worker# Verify that use of .localentry implies ABI version 2
42*9880d681SAndroid Build Coastguard Worker# CHECK: ElfHeader {
43*9880d681SAndroid Build Coastguard Worker# CHECK: Flags [ (0x2)
44*9880d681SAndroid Build Coastguard Worker
45*9880d681SAndroid Build Coastguard Worker# Verify that fixups to local function symbols are performed only
46*9880d681SAndroid Build Coastguard Worker# if the target symbol does not use .localentry
47*9880d681SAndroid Build Coastguard Worker# CHECK: Relocations [
48*9880d681SAndroid Build Coastguard Worker# CHECK: Section ({{[0-9]*}}) .rela.text {
49*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT: R_PPC64_REL24 callee1
50*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT: }
51*9880d681SAndroid Build Coastguard Worker# CHECK-NOT: R_PPC64_REL24 callee2
52*9880d681SAndroid Build Coastguard Worker# CHECK: Section ({{[0-9]*}}) .rela.text.other {
53*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT: R_PPC64_REL24 callee1
54*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT: R_PPC64_REL24 .text
55*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT: }
56*9880d681SAndroid Build Coastguard Worker
57*9880d681SAndroid Build Coastguard Worker# Verify that .localentry is encoded in the Other field.
58*9880d681SAndroid Build Coastguard Worker# CHECK: Symbols [
59*9880d681SAndroid Build Coastguard Worker# CHECK:       Name: callee1
60*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT:  Value:
61*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT:  Size: 16
62*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT:  Binding: Local
63*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT:  Type: Function
64*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT:  Other [ (0x60)
65*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT:  ]
66*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT:  Section: .text
67*9880d681SAndroid Build Coastguard Worker# CHECK:       Name: callee2
68*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT:  Value:
69*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT:  Size: 8
70*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT:  Binding: Local
71*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT:  Type: Function
72*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT:  Other: 0
73*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT:  Section: .text
74*9880d681SAndroid Build Coastguard Worker
75*9880d681SAndroid Build Coastguard Worker# Verify that symbol assignment copies the Other bits.
76*9880d681SAndroid Build Coastguard Worker# CHECK:       Name: copy1
77*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT:  Value:
78*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT:  Size: 16
79*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT:  Binding: Local
80*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT:  Type: Function
81*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT:  Other [ (0x60)
82*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT:  ]
83*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT:  Section: .text
84*9880d681SAndroid Build Coastguard Worker# CHECK:       Name: copy2
85*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT:  Value:
86*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT:  Size: 8
87*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT:  Binding: Local
88*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT:  Type: Function
89*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT:  Other: 0
90*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT:  Section: .text
91*9880d681SAndroid Build Coastguard Worker
92