| 1 |
# crti.s for sysv4 |
| 2 |
|
| 3 |
# Copyright (C) 1996-2025 Free Software Foundation, Inc. |
| 4 |
# Written By Michael Meissner |
| 5 |
# |
| 6 |
# This file is free software; you can redistribute it and/or modify it |
| 7 |
# under the terms of the GNU General Public License as published by the |
| 8 |
# Free Software Foundation; either version 3, or (at your option) any |
| 9 |
# later version. |
| 10 |
# |
| 11 |
# This file is distributed in the hope that it will be useful, but |
| 12 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 |
# General Public License for more details. |
| 15 |
# |
| 16 |
# Under Section 7 of GPL version 3, you are granted additional |
| 17 |
# permissions described in the GCC Runtime Library Exception, version |
| 18 |
# 3.1, as published by the Free Software Foundation. |
| 19 |
# |
| 20 |
# You should have received a copy of the GNU General Public License and |
| 21 |
# a copy of the GCC Runtime Library Exception along with this program; |
| 22 |
# see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
| 23 |
# <http://www.gnu.org/licenses/>. |
| 24 |
|
| 25 |
# This file just supplies labeled starting points for the .got* and other |
| 26 |
# special sections. It is linked in first before other modules. |
| 27 |
|
| 28 |
.ident "GNU C scrti.s" |
| 29 |
|
| 30 |
#ifndef __powerpc64__ |
| 31 |
# Start of .text |
| 32 |
.section ".text" |
| 33 |
.globl _ex_text0 |
| 34 |
_ex_text0: |
| 35 |
|
| 36 |
# Exception range |
| 37 |
.section ".exception_ranges","aw" |
| 38 |
.globl _ex_range0 |
| 39 |
_ex_range0: |
| 40 |
|
| 41 |
# List of C++ constructors |
| 42 |
.section ".ctors","aw" |
| 43 |
.globl __CTOR_LIST__ |
| 44 |
.type __CTOR_LIST__,@object |
| 45 |
__CTOR_LIST__: |
| 46 |
|
| 47 |
# List of C++ destructors |
| 48 |
.section ".dtors","aw" |
| 49 |
.globl __DTOR_LIST__ |
| 50 |
.type __DTOR_LIST__,@object |
| 51 |
__DTOR_LIST__: |
| 52 |
|
| 53 |
# Head of _init function used for static constructors |
| 54 |
.section ".init","ax" |
| 55 |
.align 2 |
| 56 |
.globl _init |
| 57 |
.type _init,@function |
| 58 |
_init: stwu %r1,-16(%r1) |
| 59 |
mflr %r0 |
| 60 |
stw %r31,12(%r1) |
| 61 |
stw %r0,16(%r1) |
| 62 |
|
| 63 |
bl _GLOBAL_OFFSET_TABLE_-4 # get the GOT address |
| 64 |
mflr %r31 |
| 65 |
|
| 66 |
# lwz %r3,_ex_shared0@got(%r31) |
| 67 |
# lwz %r4,-8(%r3) # _ex_register or 0 |
| 68 |
# cmpi %cr0,%r4,0 |
| 69 |
# beq .Lno_reg |
| 70 |
# mtlr %r4 |
| 71 |
# blrl |
| 72 |
#.Lno_reg: |
| 73 |
|
| 74 |
# Head of _fini function used for static destructors |
| 75 |
.section ".fini","ax" |
| 76 |
.align 2 |
| 77 |
.globl _fini |
| 78 |
.type _fini,@function |
| 79 |
_fini: stwu %r1,-16(%r1) |
| 80 |
mflr %r0 |
| 81 |
stw %r31,12(%r1) |
| 82 |
stw %r0,16(%r1) |
| 83 |
|
| 84 |
bl _GLOBAL_OFFSET_TABLE_-4 # get the GOT address |
| 85 |
mflr %r31 |
| 86 |
|
| 87 |
# _environ and its evil twin environ, pointing to the environment |
| 88 |
.section ".sdata","aw" |
| 89 |
.align 2 |
| 90 |
.globl _environ |
| 91 |
.space 4 |
| 92 |
.weak environ |
| 93 |
.set environ,_environ |
| 94 |
#endif |