|
Packit Service |
82fcde |
/* Special .init and .fini section support for MicroBlaze.
|
|
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 |
addik r1,r1,-32
|
|
Packit Service |
82fcde |
swi r20,r1,28
|
|
Packit Service |
82fcde |
mfs r20,rpc
|
|
Packit Service |
82fcde |
addik r20,r20,_GLOBAL_OFFSET_TABLE_+8
|
|
Packit Service |
82fcde |
lwi r3,r20,PREINIT_FUNCTION@GOT
|
|
Packit Service |
82fcde |
#if PREINIT_FUNCTION_WEAK
|
|
Packit Service |
82fcde |
beqid r3,$Lno_weak_fn:
|
|
Packit Service |
82fcde |
swi r15,r1,0
|
|
Packit Service |
82fcde |
brlid r15,PREINIT_FUNCTION@PLT
|
|
Packit Service |
82fcde |
$Lno_weak_fn:
|
|
Packit Service |
82fcde |
#else
|
|
Packit Service |
82fcde |
swi r15,r1,0
|
|
Packit Service |
82fcde |
brald r15,r3
|
|
Packit Service |
82fcde |
#endif
|
|
Packit Service |
82fcde |
nop # Unfilled delay slot
|
|
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 |
addik r1,r1,-32
|
|
Packit Service |
82fcde |
swi r20,r1,28
|
|
Packit Service |
82fcde |
swi r15,r1,0
|
|
Packit Service |
82fcde |
mfs r20,rpc
|
|
Packit Service |
82fcde |
addik r20,r20,_GLOBAL_OFFSET_TABLE_+8
|