2.9
[glibc/nacl-glibc.git] / sysdeps / s390 / s390-64 / initfini.c
blob083a16044c0ba50b4c66feeed8b137bd73446fa0
1 /* Special .init and .fini section support for 64 bit S/390.
2 Copyright (C) 2001 Free Software Foundation, Inc.
3 Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
4 This file is part of the GNU C Library.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 In addition to the permissions in the GNU Lesser General Public
12 License, the Free Software Foundation gives you unlimited
13 permission to link the compiled version of this file with other
14 programs, and to distribute those programs without any restriction
15 coming from the use of this file. (The GNU Lesser General Public
16 License restrictions do apply in other respects; for example, they
17 cover modification of the file, and distribution when not linked
18 into another program.)
20 Note that people who make modified versions of this file are not
21 obligated to grant this special exception for their modified
22 versions; it is their choice whether to do so. The GNU Lesser
23 General Public License gives permission to release a modified
24 version without this exception; this exception also makes it
25 possible to release a modified version which carries forward this
26 exception.
28 The GNU C Library is distributed in the hope that it will be useful,
29 but WITHOUT ANY WARRANTY; without even the implied warranty of
30 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
31 Lesser General Public License for more details.
33 You should have received a copy of the GNU Lesser General Public
34 License along with the GNU C Library; if not, write to the Free
35 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
36 02111-1307 USA. */
38 /* This file is compiled into assembly code which is then munged by a sed
39 script into two files: crti.s and crtn.s.
41 * crti.s puts a function prologue at the beginning of the
42 .init and .fini sections and defines global symbols for
43 those addresses, so they can be called as functions.
45 * crtn.s puts the corresponding function epilogues
46 in the .init and .fini sections. */
48 __asm__ ("\
49 \n\
50 #include \"defs.h\"\n\
51 \n\
52 /*@HEADER_ENDS*/\n\
53 \n\
54 /*@TESTS_BEGIN*/\n\
55 \n\
56 /*@TESTS_END*/\n\
57 \n\
58 /*@_init_PROLOG_BEGINS*/\n\
59 \n\
60 .section .init\n\
61 #NO_APP\n\
62 .align 4\n\
63 .globl _init\n\
64 .type _init,@function\n\
65 _init:\n\
66 # leaf function 0\n\
67 # automatics 0\n\
68 # outgoing args 0\n\
69 # need frame pointer 0\n\
70 # call alloca 0\n\
71 # has varargs 0\n\
72 # incoming args (stack) 0\n\
73 # function length 36\n\
74 STMG 6,15,48(15)\n\
75 LGR 1,15\n\
76 AGHI 15,-160\n\
77 STG 1,0(15)\n\
78 LARL 12,_GLOBAL_OFFSET_TABLE_\n\
79 LARL 1,__gmon_start__@GOTENT\n\
80 LG 1,0(1)\n\
81 LTGR 1,1\n\
82 JE .L22\n\
83 BASR 14,1\n\
84 .L22:\n\
85 #APP\n\
86 .align 4,0x07\n\
87 END_INIT\n\
88 \n\
89 /*@_init_PROLOG_ENDS*/\n\
90 \n\
91 /*@_init_EPILOG_BEGINS*/\n\
92 .align 4\n\
93 .section .init\n\
94 #NO_APP\n\
95 .align 4\n\
96 LG 4,272(15)\n\
97 LMG 6,15,208(15)\n\
98 BR 4\n\
99 #APP\n\
100 END_INIT\n\
102 /*@_init_EPILOG_ENDS*/\n\
104 /*@_fini_PROLOG_BEGINS*/\n\
105 .section .fini\n\
106 #NO_APP\n\
107 .align 4\n\
108 .globl _fini\n\
109 .type _fini,@function\n\
110 _fini:\n\
111 # leaf function 0\n\
112 # automatics 0\n\
113 # outgoing args 0\n\
114 # need frame pointer 0\n\
115 # call alloca 0\n\
116 # has varargs 0\n\
117 # incoming args (stack) 0\n\
118 # function length 30\n\
119 STMG 6,15,48(15)\n\
120 LGR 1,15\n\
121 AGHI 15,-160\n\
122 STG 1,0(15)\n\
123 LARL 12,_GLOBAL_OFFSET_TABLE_\n\
124 #APP\n\
125 .align 4,0x07\n\
126 END_FINI\n\
128 /*@_fini_PROLOG_ENDS*/\n\
130 /*@_fini_EPILOG_BEGINS*/\n\
131 .align 4\n\
132 .section .fini\n\
133 #NO_APP\n\
134 .align 4\n\
135 LG 4,272(15)\n\
136 LMG 6,15,208(15)\n\
137 BR 4\n\
138 #APP\n\
139 END_FINI\n\
141 /*@_fini_EPILOG_ENDS*/\n\
143 /*@TRAILER_BEGINS*/\