1 /* Special .init and .fini section support for HPPA
2 Copyright (C) 2000, 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 In addition to the permissions in the GNU Lesser General Public
11 License, the Free Software Foundation gives you unlimited
12 permission to link the compiled version of this file with other
13 programs, and to distribute those programs without any restriction
14 coming from the use of this file. (The GNU Lesser General Public
15 License restrictions do apply in other respects; for example, they
16 cover modification of the file, and distribution when not linked
17 into another program.)
19 Note that people who make modified versions of this file are not
20 obligated to grant this special exception for their modified
21 versions; it is their choice whether to do so. The GNU Lesser
22 General Public License gives permission to release a modified
23 version without this exception; this exception also makes it
24 possible to release a modified version which carries forward this
27 The GNU C Library is distributed in the hope that it will be useful,
28 but WITHOUT ANY WARRANTY; without even the implied warranty of
29 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30 Lesser General Public License for more details.
32 You should have received a copy of the GNU Lesser General Public
33 License along with the GNU C Library; if not, write to the Free
34 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
37 /* This file is compiled into assembly code which is then munged by a sed
38 script into two files: crti.s and crtn.s.
40 * crti.s puts a function prologue at the beginning of the
41 .init and .fini sections and defines global symbols for
42 those addresses, so they can be called as functions.
44 * crtn.s puts the corresponding function epilogues
45 in the .init and .fini sections. */
47 /* If we use the standard C version, the linkage table pointer won't
48 be properly preserved due to the splitting up of function prologues
49 and epilogues. Therefore we write these in assembly to make sure
50 they do the right thing.
52 Note that we cannot have a weak undefined __gmon_start__, because
53 that would require this to be PIC, and the linker is currently not
54 able to generate a proper procedure descriptor for _init. Sad but
55 true. Anyway, HPPA is one of those horrible architectures where
56 making the comparison and indirect call is quite expensive (see the
57 comment in sysdeps/generic/initfini.c). */
61 #include \"defs.h\"\n\
65 /*@_init_PROLOG_BEGINS*/\n\
69 .type _init,@function\n\
74 bl __gmon_start__,%rp\n\
75 copy %r19,%r4 /* delay slot */\n\
77 /*@_init_PROLOG_ENDS*/\n\
79 /*@_init_EPILOG_BEGINS*/\n\
82 .weak __gmon_start__\n\
83 .type __gmon_start__,@function\n\
92 /* Here is the tail end of _init. We put __gmon_start before this so\n\
93 that the assembler creates the .PARISC.unwind section for us, ie.\n\
94 with the right attributes. */\n\
102 /* Our very own unwind info, because the assembler can't handle\n\
103 functions split into two or more pieces. */\n\
104 .section .PARISC.unwind\n\
106 .word _init, _end_init\n\
107 .byte 0x08, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08\n\
109 /*@_init_EPILOG_ENDS*/\n\
111 /*@_fini_PROLOG_BEGINS*/\n\
115 .type _fini,@function\n\
121 /*@_fini_PROLOG_ENDS*/\n\
123 /*@_fini_EPILOG_BEGINS*/\n\
131 .section .PARISC.unwind\n\
133 .word _fini, _end_fini\n\
134 .byte 0x08, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08\n\
136 /*@_fini_EPILOG_ENDS*/\n\