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