(__getlogin_r_loginuid): Also fail if tpwd after pwuid call is NULL.
[glibc.git] / sysdeps / sh / elf / initfini.c
blob2ae328caa2dcc79fd1238503617079ea1c7715a6
1 /* Special .init and .fini section support for SH.
2 Copyright (C) 2000, 2002, 2009 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
25 exception.
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
35 02111-1307 USA. */
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 __asm__ ("\
48 \n\
49 #include \"defs.h\"\n\
50 \n\
51 /*@HEADER_ENDS*/\n\
52 \n\
53 /*@TESTS_BEGIN*/\n\
54 .align 5\n\
55 /*@TESTS_END*/\n\
56 \n\
57 /*@_init_PROLOG_BEGINS*/\n\
58 .section .init,\"ax\",@progbits\n\
59 .align 5\n\
60 .global _init\n\
61 .type _init, @function\n\
62 _init:\n\
63 mov.l r12,@-r15\n\
64 mova .L12,r0\n\
65 mov.l .L12,r12\n\
66 mov.l r14,@-r15\n\
67 add r0,r12\n\
68 mov.l .L13,r0\n\
69 sts.l pr,@-r15\n\
70 mov.l @(r0,r12),r1\n\
71 tst r1,r1\n\
72 bt/s .L8\n\
73 mov r15,r14\n\
74 mov.l .L14,r1\n\
75 bsrf r1\n\
76 .LPCS0:\n\
77 nop\n\
78 .L8:\n\
79 bra 1f\n\
80 nop\n\
81 .align 2\n\
82 .L12:\n\
83 .long _GLOBAL_OFFSET_TABLE_\n\
84 .L13:\n\
85 .long __gmon_start__@GOT\n\
86 .L14:\n\
87 .long __gmon_start__@PLT-(.LPCS0+2-(.))\n\
88 1:\n\
89 ALIGN\n\
90 END_INIT\n\
91 \n\
92 /*@_init_PROLOG_ENDS*/\n\
93 \n\
94 /*@_init_EPILOG_BEGINS*/\n\
95 .section .init\n\
96 mov r14,r15\n\
97 lds.l @r15+,pr\n\
98 mov.l @r15+,r14\n\
99 mov.l @r15+,r12\n\
100 rts \n\
101 nop\n\
102 END_INIT\n\
104 /*@_init_EPILOG_ENDS*/\n\
106 /*@_fini_PROLOG_BEGINS*/\n\
107 .section .fini,\"ax\",@progbits\n\
108 .align 5\n\
109 .global _fini\n\
110 .type _fini, @function\n\
111 _fini:\n\
112 mov.l r12,@-r15\n\
113 mova .L19,r0\n\
114 mov.l r14,@-r15\n\
115 sts.l pr,@-r15\n\
116 mov.l .L19,r12\n\
117 mov r15,r14\n\
118 add r0,r12\n\
119 bra 0f\n\
120 nop\n\
121 .align 2\n\
122 .L19:\n\
123 .long _GLOBAL_OFFSET_TABLE_\n\
124 0:\n\
125 ALIGN\n\
126 END_FINI\n\
128 /*@_fini_PROLOG_ENDS*/\n\
129 mov.l .L20,r1\n\
130 bsrf r1\n\
131 .LPCS1:\n\
132 nop\n\
133 bra 1f\n\
134 nop\n\
135 .align 2\n\
136 .L20:\n\
137 .long i_am_not_a_leaf@PLT-(.LPCS1+2-(.))\n\
138 1:\n\
139 /*@_fini_EPILOG_BEGINS*/\n\
140 .section .fini\n\
141 mov r14,r15\n\
142 lds.l @r15+,pr\n\
143 mov.l @r15+,r14\n\
144 mov.l @r15+,r12\n\
145 rts \n\
146 nop\n\
147 END_FINI\n\
149 /*@_fini_EPILOG_ENDS*/\n\
151 /*@TRAILER_BEGINS*/\n\
152 .weak __gmon_start__\n\