public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Ulrich Drepper <drepper@redhat.com>
Cc: Glibc hackers <libc-hacker@sources.redhat.com>
Subject: [PATCH] Fix atexit stuff
Date: Tue, 10 Mar 2009 13:14:00 -0000	[thread overview]
Message-ID: <20090310132117.GI16681@sunsite.ms.mff.cuni.cz> (raw)

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

                 reply	other threads:[~2009-03-10 13:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090310132117.GI16681@sunsite.ms.mff.cuni.cz \
    --to=jakub@redhat.com \
    --cc=drepper@redhat.com \
    --cc=libc-hacker@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).