This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
PATCH: Mark __dso_handle hidden
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Wed, 15 Jun 2011 06:10:12 -0700
- Subject: PATCH: Mark __dso_handle hidden
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Since __dso_handle is always hidden, we can optimize atexit by marking
__dso_handle hidden.
H.J.
---
2011-06-14 H.J. Lu <hongjiu.lu@intel.com>
* stdlib/atexit.c (__dso_handle): Remove weak and mark it hidden.
(atexit): Always pass __dso_handle to __cxa_atexit.
diff --git a/stdlib/atexit.c b/stdlib/atexit.c
index 256c5fc..973e095 100644
--- a/stdlib/atexit.c
+++ b/stdlib/atexit.c
@@ -38,8 +38,7 @@
/* This is defined by newer gcc version unique for each module. */
-extern void *__dso_handle __attribute__ ((__weak__));
-
+extern const void *__dso_handle __attribute__ ((__visibility__ ("hidden")));
/* Register FUNC to be executed by `exit'. */
int
@@ -48,6 +47,5 @@ attribute_hidden
#endif
atexit (void (*func) (void))
{
- return __cxa_atexit ((void (*) (void *)) func, NULL,
- &__dso_handle == NULL ? NULL : __dso_handle);
+ return __cxa_atexit ((void (*) (void *)) func, NULL, __dso_handle);
}