Blame sysdeps/powerpc/powerpc32/crti.S

Packit Service 82fcde
/* Special .init and .fini section support for PowerPC.
Packit Service 82fcde
   Copyright (C) 2012-2018 Free Software Foundation, Inc.
Packit Service 82fcde
   This file is part of the GNU C Library.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is free software; you can redistribute it and/or
Packit Service 82fcde
   modify it under the terms of the GNU Lesser General Public
Packit Service 82fcde
   License as published by the Free Software Foundation; either
Packit Service 82fcde
   version 2.1 of the License, or (at your option) any later version.
Packit Service 82fcde
Packit Service 82fcde
   In addition to the permissions in the GNU Lesser General Public
Packit Service 82fcde
   License, the Free Software Foundation gives you unlimited
Packit Service 82fcde
   permission to link the compiled version of this file with other
Packit Service 82fcde
   programs, and to distribute those programs without any restriction
Packit Service 82fcde
   coming from the use of this file. (The GNU Lesser General Public
Packit Service 82fcde
   License restrictions do apply in other respects; for example, they
Packit Service 82fcde
   cover modification of the file, and distribution when not linked
Packit Service 82fcde
   into another program.)
Packit Service 82fcde
Packit Service 82fcde
   Note that people who make modified versions of this file are not
Packit Service 82fcde
   obligated to grant this special exception for their modified
Packit Service 82fcde
   versions; it is their choice whether to do so. The GNU Lesser
Packit Service 82fcde
   General Public License gives permission to release a modified
Packit Service 82fcde
   version without this exception; this exception also makes it
Packit Service 82fcde
   possible to release a modified version which carries forward this
Packit Service 82fcde
   exception.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is distributed in the hope that it will be useful,
Packit Service 82fcde
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 82fcde
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 82fcde
   Lesser General Public License for more details.
Packit Service 82fcde
Packit Service 82fcde
   You should have received a copy of the GNU Lesser General Public
Packit Service 82fcde
   License along with the GNU C Library; if not, see
Packit Service 82fcde
   <http://www.gnu.org/licenses/>.  */
Packit Service 82fcde
Packit Service 82fcde
/* crti.S puts a function prologue at the beginning of the .init and
Packit Service 82fcde
   .fini sections and defines global symbols for those addresses, so
Packit Service 82fcde
   they can be called as functions.  The symbols _init and _fini are
Packit Service 82fcde
   magic and cause the linker to emit DT_INIT and DT_FINI.  */
Packit Service 82fcde
Packit Service 82fcde
#include <libc-symbols.h>
Packit Service 82fcde
#include <sysdep.h>
Packit Service 82fcde
Packit Service 82fcde
#ifndef PREINIT_FUNCTION
Packit Service 82fcde
# define PREINIT_FUNCTION __gmon_start__
Packit Service 82fcde
#endif
Packit Service 82fcde
Packit Service 82fcde
#ifndef PREINIT_FUNCTION_WEAK
Packit Service 82fcde
# define PREINIT_FUNCTION_WEAK 1
Packit Service 82fcde
#endif
Packit Service 82fcde
Packit Service 82fcde
#if PREINIT_FUNCTION_WEAK
Packit Service 82fcde
	weak_extern (PREINIT_FUNCTION)
Packit Service 82fcde
#else
Packit Service 82fcde
	.hidden PREINIT_FUNCTION
Packit Service 82fcde
#endif
Packit Service 82fcde
Packit Service 82fcde
	.section .init,"ax",@progbits
Packit Service 82fcde
	.align	2
Packit Service 82fcde
	.globl	_init
Packit Service 82fcde
	.hidden	_init
Packit Service 82fcde
	.type	_init, @function
Packit Service 82fcde
_init:
Packit Service 82fcde
	stwu r1, -16(r1)
Packit Service 82fcde
	mflr r0
Packit Service 82fcde
	stw r0, 20(r1)
Packit Service 82fcde
	stw r30, 8(r1)
Packit Service 82fcde
	SETUP_GOT_ACCESS (r30, .Lgot_label_i)
Packit Service 82fcde
	addis r30, r30, _GLOBAL_OFFSET_TABLE_-.Lgot_label_i@ha
Packit Service 82fcde
	addi r30, r30, _GLOBAL_OFFSET_TABLE_-.Lgot_label_i@l
Packit Service 82fcde
#if PREINIT_FUNCTION_WEAK
Packit Service 82fcde
	lwz r0, PREINIT_FUNCTION@got(r30)
Packit Service 82fcde
	cmpwi cr7, r0, 0
Packit Service 82fcde
	beq+ cr7, 1f
Packit Service 82fcde
	bl PREINIT_FUNCTION@plt
Packit Service 82fcde
1:
Packit Service 82fcde
#else
Packit Service 82fcde
	bl PREINIT_FUNCTION@local
Packit Service 82fcde
#endif
Packit Service 82fcde
Packit Service 82fcde
	.section .fini,"ax",@progbits
Packit Service 82fcde
	.align	2
Packit Service 82fcde
	.globl	_fini
Packit Service 82fcde
	.hidden	_fini
Packit Service 82fcde
	.type	_fini, @function
Packit Service 82fcde
_fini:
Packit Service 82fcde
	stwu r1, -16(r1)
Packit Service 82fcde
	mflr r0
Packit Service 82fcde
	stw r0, 20(r1)
Packit Service 82fcde
	stw r30, 8(r1)
Packit Service 82fcde
	SETUP_GOT_ACCESS (r30, .Lgot_label_f)