libpthread: add missing file for gdbserver
[uclibc-ng.git] / libpthread / linuxthreads / sysdeps / unix / sysv / linux / ia64 / pt-initfini.c
blob025566587ddeb015b1b8ef1cecdc875d916df2f9
1 /* Special .init and .fini section support for ia64. LinuxThreads version.
2 Copyright (C) 2000, 2001, 2002, 2003 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
6 and/or 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 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 The GNU C Library is distributed in the hope that it will be
20 useful, but WITHOUT ANY WARRANTY; without even the implied warranty
21 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU Lesser General Public License for more details.
24 You should have received a copy of the GNU Lesser General Public
25 License along with the GNU C Library; see the file COPYING.LIB. If not,
26 see <http://www.gnu.org/licenses/>. */
28 /* This file is compiled into assembly code which is then munged by a sed
29 script into two files: crti.s and crtn.s.
31 * crti.s puts a function prologue at the beginning of the
32 .init and .fini sections and defines global symbols for
33 those addresses, so they can be called as functions.
35 * crtn.s puts the corresponding function epilogues
36 in the .init and .fini sections. */
38 #include <stddef.h>
40 #ifdef HAVE_INITFINI_ARRAY
42 # define INIT_NEW_WAY \
43 ".xdata8 \".init_array\", @fptr(__pthread_initialize_minimal)\n"
44 # define INIT_OLD_WAY ""
45 #else
46 # define INIT_NEW_WAY ""
47 # define INIT_OLD_WAY \
48 "\n\
49 st8 [r12] = gp, -16\n\
50 br.call.sptk.many b0 = __pthread_initialize_minimal# ;;\n\
51 ;;\n\
52 adds r12 = 16, r12\n\
53 ;;\n\
54 ld8 gp = [r12]\n\
55 ;;\n"
56 #endif
58 __asm__ ("\n\
59 \n\
60 #include \"defs.h\"\n\
61 \n\
62 /*@HEADER_ENDS*/\n\
63 \n\
64 /*@_init_PROLOG_BEGINS*/\n"
65 INIT_NEW_WAY
66 ".section .init\n\
67 .align 16\n\
68 .global _init#\n\
69 .proc _init#\n\
70 _init:\n\
71 .prologue\n\
72 .save ar.pfs, r34\n\
73 alloc r34 = ar.pfs, 0, 3, 0, 0\n\
74 .vframe r32\n\
75 mov r32 = r12\n\
76 .save rp, r33\n\
77 mov r33 = b0\n\
78 .body\n\
79 adds r12 = -16, r12\n\
80 ;;\n"
81 INIT_OLD_WAY
82 ".endp _init#\n\
83 \n\
84 /*@_init_PROLOG_ENDS*/\n\
85 \n\
86 /*@_init_EPILOG_BEGINS*/\n\
87 .section .init\n\
88 .proc _init#\n\
89 _init:\n\
90 .prologue\n\
91 .save ar.pfs, r34\n\
92 .vframe r32\n\
93 .save rp, r33\n\
94 .body\n\
95 mov r12 = r32\n\
96 mov ar.pfs = r34\n\
97 mov b0 = r33\n\
98 br.ret.sptk.many b0\n\
99 .endp _init#\n\
100 /*@_init_EPILOG_ENDS*/\n\
102 /*@_fini_PROLOG_BEGINS*/\n\
103 .section .fini\n\
104 .align 16\n\
105 .global _fini#\n\
106 .proc _fini#\n\
107 _fini:\n\
108 .prologue\n\
109 .save ar.pfs, r34\n\
110 alloc r34 = ar.pfs, 0, 3, 0, 0\n\
111 .vframe r32\n\
112 mov r32 = r12\n\
113 .save rp, r33\n\
114 mov r33 = b0\n\
115 .body\n\
116 adds r12 = -16, r12\n\
117 ;;\n\
118 .endp _fini#\n\
120 /*@_fini_PROLOG_ENDS*/\n\
122 /*@_fini_EPILOG_BEGINS*/\n\
123 .section .fini\n\
124 .proc _fini#\n\
125 _fini:\n\
126 .prologue\n\
127 .save ar.pfs, r34\n\
128 .vframe r32\n\
129 .save rp, r33\n\
130 .body\n\
131 mov r12 = r32\n\
132 mov ar.pfs = r34\n\
133 mov b0 = r33\n\
134 br.ret.sptk.many b0\n\
135 .endp _fini#\n\
137 /*@_fini_EPILOG_ENDS*/\n\
139 /*@TRAILER_BEGINS*/\n\
140 .weak __gmon_start__#\n\