Blame sysdeps/powerpc/powerpc64/start.S

Packit 6c4009
/* Startup code for programs linked with GNU libc.  PowerPC64 version.
Packit 6c4009
   Copyright (C) 1998-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   In addition to the permissions in the GNU Lesser General Public
Packit 6c4009
   License, the Free Software Foundation gives you unlimited
Packit 6c4009
   permission to link the compiled version of this file with other
Packit 6c4009
   programs, and to distribute those programs without any restriction
Packit 6c4009
   coming from the use of this file. (The GNU Lesser General Public
Packit 6c4009
   License restrictions do apply in other respects; for example, they
Packit 6c4009
   cover modification of the file, and distribution when not linked
Packit 6c4009
   into another program.)
Packit 6c4009
Packit 6c4009
   Note that people who make modified versions of this file are not
Packit 6c4009
   obligated to grant this special exception for their modified
Packit 6c4009
   versions; it is their choice whether to do so. The GNU Lesser
Packit 6c4009
   General Public License gives permission to release a modified
Packit 6c4009
   version without this exception; this exception also makes it
Packit 6c4009
   possible to release a modified version which carries forward this
Packit 6c4009
   exception.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#include <sysdep.h>
Packit 6c4009
Packit 6c4009
/* We do not want .eh_frame info for crt1.o since crt1.o is linked
Packit 6c4009
   before crtbegin.o, the file defining __EH_FRAME_BEGIN__.  */
Packit 6c4009
#undef cfi_startproc
Packit 6c4009
#define cfi_startproc
Packit 6c4009
#undef cfi_endproc
Packit 6c4009
#define cfi_endproc
Packit 6c4009
Packit 6c4009
 /* These are the various addresses we require.  */
Packit 6c4009
#ifdef PIC
Packit 6c4009
	.section ".data.rel.ro.local","aw"
Packit 6c4009
#else
Packit 6c4009
	.section ".rodata"
Packit 6c4009
#endif
Packit 6c4009
	.align	3
Packit 6c4009
L(start_addresses):
Packit 6c4009
	.quad	0 /* was _SDA_BASE_  but not in 64-bit ABI*/
Packit 6c4009
/*     function descriptors so don't need JUMPTARGET */
Packit 6c4009
	.quad	main
Packit 6c4009
	.quad 	__libc_csu_init
Packit 6c4009
	.quad 	__libc_csu_fini
Packit 6c4009
Packit 6c4009
	ASM_SIZE_DIRECTIVE(L(start_addresses))
Packit 6c4009
Packit 6c4009
	.section	".toc","aw"
Packit 6c4009
.L01:
Packit 6c4009
	.tc	L(start_addresses)[TC],L(start_addresses)
Packit 6c4009
	.section ".text"
Packit 6c4009
ENTRY (_start)
Packit 6c4009
 /* Save the stack pointer, in case we're statically linked under Linux.  */
Packit 6c4009
	mr	r9,r1
Packit 6c4009
 /* Set up an initial stack frame, and clear the LR.  */
Packit 6c4009
	clrrdi	r1,r1,4
Packit 6c4009
	li	r0,0
Packit 6c4009
	stdu	r1,-128(r1)
Packit 6c4009
	mtlr	r0
Packit 6c4009
	std	r0,0(r1)
Packit 6c4009
Packit 6c4009
 /* put the address of start_addresses in r8...  **
Packit 6c4009
** PPC64 ABI uses R13 for thread local, so we leave it alone */
Packit 6c4009
	ld	r8,.L01@toc(r2)
Packit 6c4009
Packit 6c4009
 /* and continue in libc-start, in glibc.  */
Packit 6c4009
	b	JUMPTARGET(__libc_start_main)
Packit 6c4009
/* Older versions of ld need this nop to recognize that it's OK to call via a
Packit 6c4009
   TOC adjusting stub.  */
Packit 6c4009
	nop
Packit 6c4009
Packit 6c4009
END(_start)
Packit 6c4009
Packit 6c4009
/* Define a symbol for the first piece of initialized data.  */
Packit 6c4009
	.section ".data"
Packit 6c4009
	.globl	__data_start
Packit 6c4009
__data_start:
Packit 6c4009
	.long	0
Packit 6c4009
weak_alias (__data_start, data_start)