@@ -35,9 +35,7 @@ dummy (void)
void
foo (void *p)
{
- extern void *__dso_handle __attribute__ ((__weak__));
printf ("This is %s\n", __FUNCTION__);
atexit (dummy);
- if (&__dso_handle) puts ("have dso handle"); else puts ("no dso handle");
ip = p;
}
@@ -34,7 +34,6 @@ fluffy (void *p)
void
bar (void *p)
{
- extern void *__dso_handle;
printf ("This is %s\n", __FUNCTION__);
__cxa_atexit (fluffy, p, __dso_handle);
}
@@ -20,8 +20,6 @@
#include <stdlib.h>
-extern void *__dso_handle __attribute__ ((__weak__));
-
int
main (void)
{
@@ -30,12 +28,6 @@ main (void)
void (*fp) (void *);
int v = 0;
- if (&__dso_handle == NULL)
- {
- puts ("__dso_handle not available, cannot perform the test");
- exit (0);
- }
-
h = dlopen (fname, RTLD_NOW);
if (h == NULL)
{
@@ -19,8 +19,6 @@
#include <stdio.h>
#include <stdlib.h>
-extern void *__dso_handle __attribute__ ((__weak__));
-
int
main (void)
{
@@ -29,12 +27,6 @@ main (void)
void (*fp) (void *);
int v = 0;
- if (&__dso_handle == NULL)
- {
- puts ("__dso_handle not available, cannot perform the test");
- exit (0);
- }
-
h = dlopen (fname, RTLD_LAZY);
if (h == NULL)
{
@@ -5,6 +5,10 @@
#endif
#include <stdlib/stdlib.h>
+/* __dso_handle is always defined by either crtbegin.o from GCC or our
+ dso_handle.c. */
+extern void *__dso_handle __attribute__ ((visibility ("hidden")));
+
/* Now define the internal interfaces. */
#if !defined _ISOMAC
# include <sys/stat.h>
@@ -315,10 +315,9 @@ mtrace (void)
#ifdef _LIBC
if (!added_atexit_handler)
{
- extern void *__dso_handle __attribute__ ((__weak__));
added_atexit_handler = 1;
__cxa_atexit ((void (*)(void *))release_libc_mem, NULL,
- &__dso_handle ? __dso_handle : NULL);
+ __dso_handle);
}
#endif
}
@@ -36,10 +36,6 @@
#include "pthreadP.h"
#include <fork.h>
-/* This is defined by newer gcc version unique for each module. */
-extern void *__dso_handle __attribute__ ((__weak__,
- __visibility__ ("hidden")));
-
/* Hide the symbol so that no definition but the one locally in the
executable or DSO is used. */
@@ -51,8 +47,7 @@ attribute_hidden
__pthread_atfork (void (*prepare) (void), void (*parent) (void),
void (*child) (void))
{
- return __register_atfork (prepare, parent, child,
- &__dso_handle == NULL ? NULL : __dso_handle);
+ return __register_atfork (prepare, parent, child, __dso_handle);
}
#ifndef __pthread_atfork
extern int pthread_atfork (void (*prepare) (void), void (*parent) (void),
@@ -46,7 +46,6 @@ static void
__attribute__ ((constructor))
init (void)
{
- extern void *__dso_handle;
printf ("dsohandle = %p\n", __dso_handle);
if (pthread_atfork (prepare, parent, child) != 0)
@@ -30,13 +30,11 @@
#define IFS " \n\t"
-extern void *__dso_handle __attribute__ ((__weak__, __visibility__ ("hidden")));
extern int __register_atfork (void (*) (void), void (*) (void), void (*) (void), void *);
static int __app_register_atfork (void (*prepare) (void), void (*parent) (void), void (*child) (void))
{
- return __register_atfork (prepare, parent, child,
- &__dso_handle == NULL ? NULL : __dso_handle);
+ return __register_atfork (prepare, parent, child, __dso_handle);
}
/* Number of forks seen. */
@@ -36,15 +36,10 @@
#include "exit.h"
-/* This is defined by newer gcc version unique for each module. */
-extern void *__dso_handle __attribute__ ((__weak__));
-
-
/* 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,
- &__dso_handle == NULL ? NULL : __dso_handle);
+ return __cxa_at_quick_exit ((void (*) (void *)) func, __dso_handle);
}
@@ -35,11 +35,6 @@
#include <stdlib.h>
#include "exit.h"
-
-/* This is defined by newer gcc version unique for each module. */
-extern void *__dso_handle __attribute__ ((__weak__));
-
-
/* Register FUNC to be executed by `exit'. */
int
#ifndef atexit
@@ -47,6 +42,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);
}
@@ -18,8 +18,6 @@
#include <stdlib.h>
-extern void *__dso_handle;
-
typedef struct
{
void *val;