|
Packit Service |
82fcde |
/* Special .init and .fini section support for 64 bit S/390.
|
|
Packit Service |
82fcde |
Copyright (C) 2001-2018 Free Software Foundation, Inc.
|
|
Packit Service |
82fcde |
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
|
|
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 4
|
|
Packit Service |
82fcde |
.globl _init
|
|
Packit Service |
82fcde |
.hidden _init
|
|
Packit Service |
82fcde |
.type _init,@function
|
|
Packit Service |
82fcde |
_init:
|
|
Packit Service |
82fcde |
stmg %r6,%r15,48(%r15)
|
|
Packit Service |
82fcde |
lgr %r1,%r15
|
|
Packit Service |
82fcde |
aghi %r15,-160
|
|
Packit Service |
82fcde |
stg %r1,0(%r15)
|
|
Packit Service |
82fcde |
larl %r12,_GLOBAL_OFFSET_TABLE_
|
|
Packit Service |
82fcde |
#if PREINIT_FUNCTION_WEAK
|
|
Packit Service |
82fcde |
larl %r1,PREINIT_FUNCTION@GOTENT
|
|
Packit Service |
82fcde |
lg %r1,0(%r1)
|
|
Packit Service |
82fcde |
ltgr %r1,%r1
|
|
Packit Service |
82fcde |
je 1f
|
|
Packit Service |
82fcde |
basr %r14,%r1
|
|
Packit Service |
82fcde |
#else
|
|
Packit Service |
82fcde |
brasl %r14,PREINIT_FUNCTION
|
|
Packit Service |
82fcde |
#endif
|
|
Packit Service |
82fcde |
.align 4,0x07
|
|
Packit Service |
82fcde |
1:
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
.section .fini,"ax",@progbits
|
|
Packit Service |
82fcde |
.align 4
|
|
Packit Service |
82fcde |
.globl _fini
|
|
Packit Service |
82fcde |
.hidden _fini
|
|
Packit Service |
82fcde |
.type _fini,@function
|
|
Packit Service |
82fcde |
_fini:
|
|
Packit Service |
82fcde |
stmg %r6,%r15,48(%r15)
|
|
Packit Service |
82fcde |
lgr %r1,%r15
|
|
Packit Service |
82fcde |
aghi %r15,-160
|
|
Packit Service |
82fcde |
stg %r1,0(%r15)
|
|
Packit Service |
82fcde |
larl %r12,_GLOBAL_OFFSET_TABLE_
|
|
Packit Service |
82fcde |
.align 4,0x07
|