* [PATCH] Fix atexit stuff
@ 2009-03-10 13:14 Jakub Jelinek
0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2009-03-10 13:14 UTC (permalink / raw)
To: Ulrich Drepper; +Cc: Glibc hackers
Hi!
The main problem is wrong arguments to __run_exit_handlers in exit, which
causes e.g. all mtrace related tests to fail and a bunch of others, as
atexit etc. handlers were never called.
Another issue was attribute_hidden on __cxa_at_quick_exit (which means
it wasn't exported from libc.so) instead of on at_quick_exit (which is
in libc_nonshared.a and should be hidden).
2009-03-10 Jakub Jelinek <jakub@redhat.com>
* stdlib/quick_exit.c (quick_exit): Pass &__quick_exit_funcs
instead of __quick_exit_funcs to __run_exit_handlers.
* stdlib/at_quick_exit.c (at_quick_exit): Add attribute_hidden.
* stdlib/exit.h (__run_exit_handlers): Add noreturn attribute.
(__cxa_at_quick_exit): Remove attribute_hidden.
* stdlib/exit.c (exit): Pass &__exit_funcs instead of __exit_funcs
to __run_exit_handlers.
* stdlib/cxa_at_quick_exit.c (__cxa_at_quick_exit): Remove
attribute_hidden.
--- libc/stdlib/quick_exit.c.jj 2009-03-08 20:45:09.000000000 +0100
+++ libc/stdlib/quick_exit.c 2009-03-10 13:11:09.000000000 +0100
@@ -26,5 +26,5 @@
void
quick_exit (int status)
{
- __run_exit_handlers (status, __quick_exit_funcs, false);
+ __run_exit_handlers (status, &__quick_exit_funcs, false);
}
--- libc/stdlib/at_quick_exit.c.jj 2009-03-08 20:44:51.000000000 +0100
+++ libc/stdlib/at_quick_exit.c 2009-03-10 13:09:14.000000000 +0100
@@ -43,6 +43,7 @@ extern void *__dso_handle __attribute__
/* Register FUNC to be executed by `quick_exit'. */
int
+attribute_hidden
at_quick_exit (void (*func) (void))
{
return __cxa_at_quick_exit ((void (*) (void *)) func,
--- libc/stdlib/exit.h.jj 2009-03-09 14:53:42.000000000 +0100
+++ libc/stdlib/exit.h 2009-03-10 13:11:57.000000000 +0100
@@ -66,13 +66,13 @@ extern struct exit_function *__new_exitf
extern uint64_t __new_exitfn_called attribute_hidden;
extern void __run_exit_handlers (int status, struct exit_function_list **listp,
- bool run_list_atexit) attribute_hidden;
+ bool run_list_atexit)
+ attribute_hidden __attribute__ ((__noreturn__));
extern int __internal_atexit (void (*func) (void *), void *arg, void *d,
struct exit_function_list **listp)
attribute_hidden;
-extern int __cxa_at_quick_exit (void (*func) (void *), void *d)
- attribute_hidden;
+extern int __cxa_at_quick_exit (void (*func) (void *), void *d);
#endif /* exit.h */
--- libc/stdlib/exit.c.jj 2009-03-09 14:53:42.000000000 +0100
+++ libc/stdlib/exit.c 2009-03-10 13:10:48.000000000 +0100
@@ -97,6 +97,6 @@ __run_exit_handlers (int status, struct
void
exit (int status)
{
- __run_exit_handlers (status, __exit_funcs, true);
+ __run_exit_handlers (status, &__exit_funcs, true);
}
libc_hidden_def (exit)
--- libc/stdlib/cxa_at_quick_exit.c.jj 2009-03-08 20:45:00.000000000 +0100
+++ libc/stdlib/cxa_at_quick_exit.c 2009-03-10 13:07:53.000000000 +0100
@@ -25,7 +25,6 @@ struct exit_function_list *__quick_exit_
/* Register a function to be called by quick_exit. */
int
-attribute_hidden
__cxa_at_quick_exit (void (*func) (void *), void *d)
{
return __internal_atexit (func, NULL, d, &__quick_exit_funcs);
Jakub
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-03-10 13:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-10 13:14 [PATCH] Fix atexit stuff Jakub Jelinek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).