157 are compiling for the static library in which case we haven't 158 run the constructors in `_dl_start_user'. */ 159 libc_init_first (argc, argv, environ); 160 161 /** Register the destructor of the program, if any. */ 162 if (fini)
163
164 cxa_atexit ((void (*) (void *)) fini, NULL, NULL);
165 /** Some security at this point. Prevent starting a SUID binary where
166 the standard file descriptors are not opened. We have to do this 167 only for statically linked applications since otherwise the dynamic 168 loader did the work already. */ 169 if ( builtin_expect ( libc_enable_secure, 0))
170libc_check_standard_fds ();
171 #endif
172 173 /** Call the initializer of the program, if any. */ 174 #ifdef SHARED 175 if ( builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0)) 176 GLRO(dl_debug_printf) ("\ninitialize program: %s\n\n", argv[0]); 177 #endif 178 if (init) 179 (*init) (argc, argv, environ MAIN_AUXVEC_PARAM); 180 181 #ifdef SHARED 182 /** Auditing checkpoint: we have a new object. */ 183 if ( builtin_expect (GLRO(dl_naudit) > 0, 0)) 184 { 185 struct audit_ifaces *afct = GLRO(dl_audit); 186 struct link_map *head = GL(dl_ns)[LM_ID_BASE]._ns_loaded; 187 for (unsigned int cnt = 0; cnt < GLRO(dl_naudit); ++cnt) 188 { 189 if (afct->preinit != NULL)
190 afct->preinit (&head->l_audit[cnt].cookie);
191 192 afct = afct->next; 193 } 194 } 195 #endif 196 197 #ifdef SHARED 198 if ( builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0)) 199 GLRO(dl_debug_printf) ("\ntransferring control: %s\n\n", argv[0]); 200 #endif 201 202 #ifdef HAVE_CLEANUP_JMP_BUF 203 /** Memory for the cancellation buffer. */ 204 struct pthread_unwind_buf unwind_buf; 205 206 int not_first_call;
207 not_first_call = setjmp ((struct unwind_buf.cancel_jmp_buf);
208 if ( builtin_expect (! not_first_call, 1)) 209 { 210 struct pthread *self = THREAD_SELF; 211 212 /** Store old info. */ jmp_buf_tag *)
213 unwind_buf.priv.data.prev = THREAD_GETMEM (self, cleanup_jmp_buf);
214 unwind_buf.priv.data.cleanup = THREAD_GETMEM (self, cleanup); 215 216 /** Store the new cleanup handler info. */ 217 THREAD_SETMEM (self, cleanup_jmp_buf, &unwind_buf); 218 219 /** Run the program. */ 220 result = main (argc, argv, environ MAIN_AUXVEC_PARAM); 221 } 222 else 223 { 224 /** Remove the thread-local data. */ 225 # ifdef SHARED 226 PTHFCT_CALL (ptr__nptl_deallocate_tsd, ()); 227 # else 228 extern void nptl_deallocate_tsd (void) attribute ((weak));
229 nptl_deallocate_tsd (); |