1# REQUIRES: ppc
2
3# RUN: llvm-mc -filetype=obj -triple=powerpc64 %s -o %t
4# RUN: ld.lld -r %t -o %t2
5# RUN: llvm-objdump -s --section=.symtab %t2 | FileCheck %s
6
7.text
8.abiversion 2
9.globl  _start
10.p2align	2
11.type   _start,@function
12
13_start:
14.Lfunc_begin0:
15.Lfunc_gep0:
16	addis 2, 12, .TOC.-.Lfunc_gep0@ha
17	addi 2, 2, .TOC.-.Lfunc_gep0@l
18.Lfunc_lep0:
19	.localentry	_start, .Lfunc_lep0-.Lfunc_gep0
20	# The code below is not important, it just needs to access some
21	# global data or function, in order to use the TOC.
22	# In this case, it performs the following:
23	# g += 10;
24	# Also note that this code is not intended to be run, but only
25	# to check if the linker will preserve the localentry info.
26	addis 3, 2, g@toc@ha
27	addi 3, 3, g@toc@l
28	lwz 4, 0(3)
29	addi 4, 4, 10
30	stw 4, 0(3)
31	blr
32	.long	0
33	.quad	0
34.Lfunc_end0:
35	.size   _start, .Lfunc_end0-.Lfunc_begin0
36
37	.type	g,@object               # @g
38	.lcomm	g,4,4
39
40// We expect the st_other byte to be 0x60:
41// localentry = 011 (gep + 2 instructions), reserved = 000,
42// visibility = 00 (STV_DEFAULT)
43// Currently, llvm-objdump does not support displaying
44// st_other's PPC64 specific flags, thus we check the
45// result of the hexdump of .symtab section.
46
47// CHECK: 0070 00000000 00000000 00000009 12600001
48