Update.
[glibc.git] / sysdeps / s390 / s390-32 / initfini.c
blobef38158f11678b5c8ebcc2adecac47455e5834a2
1 /* Special .init and .fini section support for S/390.
2 Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
20 /* This file is compiled into assembly code which is then munged by a sed
21 script into two files: crti.s and crtn.s.
23 * crti.s puts a function prologue at the beginning of the
24 .init and .fini sections and defines global symbols for
25 those addresses, so they can be called as functions.
27 * crtn.s puts the corresponding function epilogues
28 in the .init and .fini sections. */
30 __asm__ ("\
31 \n\
32 #include \"defs.h\"\n\
33 \n\
34 /*@HEADER_ENDS*/\n\
35 \n\
36 /*@TESTS_BEGIN*/\n\
37 \n\
38 /*@TESTS_END*/\n\
39 \n\
40 /*@_init_PROLOG_BEGINS*/\n\
41 \n\
42 .section .init\n\
43 #NO_APP\n\
44 .align 4\n\
45 .globl _init\n\
46 .type _init,@function\n\
47 _init:\n\
48 # leaf function 0\n\
49 # automatics 0\n\
50 # outgoing args 0\n\
51 # need frame pointer 0\n\
52 # call alloca 0\n\
53 # has varargs 0\n\
54 # incoming args (stack) 0\n\
55 # function length 36\n\
56 STM 6,15,24(15)\n\
57 BRAS 13,.LTN1_0\n\
58 .LT1_0:\n\
59 .LC14:\n\
60 .long __gmon_start__@GOT\n\
61 .LC15:\n\
62 .long _GLOBAL_OFFSET_TABLE_-.LT1_0\n\
63 .LTN1_0:\n\
64 LR 1,15\n\
65 AHI 15,-96\n\
66 ST 1,0(15)\n\
67 L 12,.LC15-.LT1_0(13)\n\
68 AR 12,13\n\
69 L 1,.LC14-.LT1_0(13)\n\
70 L 1,0(1,12)\n\
71 LTR 1,1\n\
72 JE .L22\n\
73 BASR 14,1\n\
74 .L22:\n\
75 #APP\n\
76 .align 4,0x07\n\
77 END_INIT\n\
78 \n\
79 /*@_init_PROLOG_ENDS*/\n\
80 \n\
81 /*@_init_EPILOG_BEGINS*/\n\
82 .align 4\n\
83 .section .init\n\
84 #NO_APP\n\
85 .align 4\n\
86 L 4,152(15)\n\
87 LM 6,15,120(15)\n\
88 BR 4\n\
89 #APP\n\
90 END_INIT\n\
91 \n\
92 /*@_init_EPILOG_ENDS*/\n\
93 \n\
94 /*@_fini_PROLOG_BEGINS*/\n\
95 .section .fini\n\
96 #NO_APP\n\
97 .align 4\n\
98 .globl _fini\n\
99 .type _fini,@function\n\
100 _fini:\n\
101 # leaf function 0\n\
102 # automatics 0\n\
103 # outgoing args 0\n\
104 # need frame pointer 0\n\
105 # call alloca 0\n\
106 # has varargs 0\n\
107 # incoming args (stack) 0\n\
108 # function length 30\n\
109 STM 6,15,24(15)\n\
110 BRAS 13,.LTN2_0\n\
111 .LT2_0:\n\
112 .LC17:\n\
113 .long _GLOBAL_OFFSET_TABLE_-.LT2_0\n\
114 .LTN2_0:\n\
115 LR 1,15\n\
116 AHI 15,-96\n\
117 ST 1,0(15)\n\
118 L 12,.LC17-.LT2_0(13)\n\
119 AR 12,13\n\
120 #APP\n\
121 .align 4,0x07\n\
122 END_FINI\n\
124 /*@_fini_PROLOG_ENDS*/\n\
126 /*@_fini_EPILOG_BEGINS*/\n\
127 .align 4\n\
128 .section .fini\n\
129 #NO_APP\n\
130 .align 4\n\
131 L 4,152(15)\n\
132 LM 6,15,120(15)\n\
133 BR 4\n\
134 #APP\n\
135 END_FINI\n\
137 /*@_fini_EPILOG_ENDS*/\n\
139 /*@TRAILER_BEGINS*/\