mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-09 14:50:05 +00:00
Mark __dso_handle as hidden [BZ #18822]
Since __dso_handle is always defined by either crtbegin.o from GCC or dso_handle.c, it should be marked as hidden and be passed directly. [BZ #18822] * dlfcn/modatexit.c (foo): Remove __dso_handle check. * dlfcn/modcxaatexit.c: Include <dso_handle.h>. (__dso_handle): Remove declaration. * dlfcn/tstatexit.c (__dso_handle): Removed. (main): Don't check __dso_handle. * dlfcn/tstcxaatexit.c (__dso_handle): Removed. (main): Don't check __dso_handle. * include/dso_handle.h: New file. * malloc/mtrace.c: Include <dso_handle.h>. (mtrace): Pass __dso_handle directly. * nptl/pthread_atfork.c: Include <dso_handle.h>. (__dso_handle): Remove declaration. (__pthread_atfork): Pass __dso_handle directly. * nptl/tst-atfork2mod.c: Include <dso_handle.h>. (__dso_handle): Removed. * posix/wordexp-test.c: Include <dso_handle.h>. (__dso_handle): Remove declaration. (__app_register_atfork): Pass __dso_handle directly. * stdlib/at_quick_exit.c: Include <dso_handle.h>. (__dso_handle): Remove declaration. (at_quick_exit): Pass __dso_handle directly. * stdlib/atexit.c: Include <dso_handle.h>. (__dso_handle): Remove declaration. (atexit): Pass __dso_handle directly. * stdlib/tst-tls-atexit-lib.c: Include <dso_handle.h>. (__dso_handle): Removed.
This commit is contained in:
parent
bfb0deb355
commit
825adeeed1
30
ChangeLog
30
ChangeLog
@ -1,3 +1,33 @@
|
|||||||
|
2017-09-26 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
|
[BZ #18822]
|
||||||
|
* dlfcn/modatexit.c (foo): Remove __dso_handle check.
|
||||||
|
* dlfcn/modcxaatexit.c: Include <dso_handle.h>.
|
||||||
|
(__dso_handle): Remove declaration.
|
||||||
|
* dlfcn/tstatexit.c (__dso_handle): Removed.
|
||||||
|
(main): Don't check __dso_handle.
|
||||||
|
* dlfcn/tstcxaatexit.c (__dso_handle): Removed.
|
||||||
|
(main): Don't check __dso_handle.
|
||||||
|
* include/dso_handle.h: New file.
|
||||||
|
* malloc/mtrace.c: Include <dso_handle.h>.
|
||||||
|
(mtrace): Pass __dso_handle directly.
|
||||||
|
* nptl/pthread_atfork.c: Include <dso_handle.h>.
|
||||||
|
(__dso_handle): Remove declaration.
|
||||||
|
(__pthread_atfork): Pass __dso_handle directly.
|
||||||
|
* nptl/tst-atfork2mod.c: Include <dso_handle.h>.
|
||||||
|
(__dso_handle): Removed.
|
||||||
|
* posix/wordexp-test.c: Include <dso_handle.h>.
|
||||||
|
(__dso_handle): Remove declaration.
|
||||||
|
(__app_register_atfork): Pass __dso_handle directly.
|
||||||
|
* stdlib/at_quick_exit.c: Include <dso_handle.h>.
|
||||||
|
(__dso_handle): Remove declaration.
|
||||||
|
(at_quick_exit): Pass __dso_handle directly.
|
||||||
|
* stdlib/atexit.c: Include <dso_handle.h>.
|
||||||
|
(__dso_handle): Remove declaration.
|
||||||
|
(atexit): Pass __dso_handle directly.
|
||||||
|
* stdlib/tst-tls-atexit-lib.c: Include <dso_handle.h>.
|
||||||
|
(__dso_handle): Removed.
|
||||||
|
|
||||||
2017-09-26 Joseph Myers <joseph@codesourcery.com>
|
2017-09-26 Joseph Myers <joseph@codesourcery.com>
|
||||||
|
|
||||||
* sysdeps/unix/make-syscalls.sh: Use __ifunc to define symbols
|
* sysdeps/unix/make-syscalls.sh: Use __ifunc to define symbols
|
||||||
|
@ -35,9 +35,7 @@ dummy (void)
|
|||||||
void
|
void
|
||||||
foo (void *p)
|
foo (void *p)
|
||||||
{
|
{
|
||||||
extern void *__dso_handle __attribute__ ((__weak__));
|
|
||||||
printf ("This is %s\n", __FUNCTION__);
|
printf ("This is %s\n", __FUNCTION__);
|
||||||
atexit (dummy);
|
atexit (dummy);
|
||||||
if (&__dso_handle) puts ("have dso handle"); else puts ("no dso handle");
|
|
||||||
ip = p;
|
ip = p;
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <dso_handle.h>
|
||||||
|
|
||||||
extern void fluffy (void *p);
|
extern void fluffy (void *p);
|
||||||
extern void bar (void *p);
|
extern void bar (void *p);
|
||||||
@ -34,7 +35,6 @@ fluffy (void *p)
|
|||||||
void
|
void
|
||||||
bar (void *p)
|
bar (void *p)
|
||||||
{
|
{
|
||||||
extern void *__dso_handle;
|
|
||||||
printf ("This is %s\n", __FUNCTION__);
|
printf ("This is %s\n", __FUNCTION__);
|
||||||
__cxa_atexit (fluffy, p, __dso_handle);
|
__cxa_atexit (fluffy, p, __dso_handle);
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
extern void *__dso_handle __attribute__ ((__weak__));
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main (void)
|
main (void)
|
||||||
{
|
{
|
||||||
@ -30,12 +28,6 @@ main (void)
|
|||||||
void (*fp) (void *);
|
void (*fp) (void *);
|
||||||
int v = 0;
|
int v = 0;
|
||||||
|
|
||||||
if (&__dso_handle == NULL)
|
|
||||||
{
|
|
||||||
puts ("__dso_handle not available, cannot perform the test");
|
|
||||||
exit (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
h = dlopen (fname, RTLD_NOW);
|
h = dlopen (fname, RTLD_NOW);
|
||||||
if (h == NULL)
|
if (h == NULL)
|
||||||
{
|
{
|
||||||
|
@ -19,8 +19,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
extern void *__dso_handle __attribute__ ((__weak__));
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main (void)
|
main (void)
|
||||||
{
|
{
|
||||||
@ -29,12 +27,6 @@ main (void)
|
|||||||
void (*fp) (void *);
|
void (*fp) (void *);
|
||||||
int v = 0;
|
int v = 0;
|
||||||
|
|
||||||
if (&__dso_handle == NULL)
|
|
||||||
{
|
|
||||||
puts ("__dso_handle not available, cannot perform the test");
|
|
||||||
exit (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
h = dlopen (fname, RTLD_LAZY);
|
h = dlopen (fname, RTLD_LAZY);
|
||||||
if (h == NULL)
|
if (h == NULL)
|
||||||
{
|
{
|
||||||
|
3
include/dso_handle.h
Normal file
3
include/dso_handle.h
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
/* __dso_handle is always defined by either crtbegin.o from GCC or our
|
||||||
|
dso_handle.c. */
|
||||||
|
extern void *__dso_handle __attribute__ ((__visibility__ ("hidden")));
|
@ -34,6 +34,7 @@
|
|||||||
#include <_itoa.h>
|
#include <_itoa.h>
|
||||||
|
|
||||||
#include <libc-internal.h>
|
#include <libc-internal.h>
|
||||||
|
#include <dso_handle.h>
|
||||||
|
|
||||||
#include <libio/iolibio.h>
|
#include <libio/iolibio.h>
|
||||||
#define setvbuf(s, b, f, l) _IO_setvbuf (s, b, f, l)
|
#define setvbuf(s, b, f, l) _IO_setvbuf (s, b, f, l)
|
||||||
@ -315,10 +316,9 @@ mtrace (void)
|
|||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
if (!added_atexit_handler)
|
if (!added_atexit_handler)
|
||||||
{
|
{
|
||||||
extern void *__dso_handle __attribute__ ((__weak__));
|
|
||||||
added_atexit_handler = 1;
|
added_atexit_handler = 1;
|
||||||
__cxa_atexit ((void (*)(void *))release_libc_mem, NULL,
|
__cxa_atexit ((void (*)(void *))release_libc_mem, NULL,
|
||||||
&__dso_handle ? __dso_handle : NULL);
|
__dso_handle);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -35,10 +35,7 @@
|
|||||||
|
|
||||||
#include "pthreadP.h"
|
#include "pthreadP.h"
|
||||||
#include <fork.h>
|
#include <fork.h>
|
||||||
|
#include <dso_handle.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
|
/* Hide the symbol so that no definition but the one locally in the
|
||||||
@ -51,8 +48,7 @@ attribute_hidden
|
|||||||
__pthread_atfork (void (*prepare) (void), void (*parent) (void),
|
__pthread_atfork (void (*prepare) (void), void (*parent) (void),
|
||||||
void (*child) (void))
|
void (*child) (void))
|
||||||
{
|
{
|
||||||
return __register_atfork (prepare, parent, child,
|
return __register_atfork (prepare, parent, child, __dso_handle);
|
||||||
&__dso_handle == NULL ? NULL : __dso_handle);
|
|
||||||
}
|
}
|
||||||
#ifndef __pthread_atfork
|
#ifndef __pthread_atfork
|
||||||
extern int pthread_atfork (void (*prepare) (void), void (*parent) (void),
|
extern int pthread_atfork (void (*prepare) (void), void (*parent) (void),
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <dso_handle.h>
|
||||||
|
|
||||||
|
|
||||||
extern int val;
|
extern int val;
|
||||||
@ -46,7 +47,6 @@ static void
|
|||||||
__attribute__ ((constructor))
|
__attribute__ ((constructor))
|
||||||
init (void)
|
init (void)
|
||||||
{
|
{
|
||||||
extern void *__dso_handle;
|
|
||||||
printf ("dsohandle = %p\n", __dso_handle);
|
printf ("dsohandle = %p\n", __dso_handle);
|
||||||
|
|
||||||
if (pthread_atfork (prepare, parent, child) != 0)
|
if (pthread_atfork (prepare, parent, child) != 0)
|
||||||
|
@ -27,16 +27,15 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <wordexp.h>
|
#include <wordexp.h>
|
||||||
#include <libc-pointer-arith.h>
|
#include <libc-pointer-arith.h>
|
||||||
|
#include <dso_handle.h>
|
||||||
|
|
||||||
#define IFS " \n\t"
|
#define IFS " \n\t"
|
||||||
|
|
||||||
extern void *__dso_handle __attribute__ ((__weak__, __visibility__ ("hidden")));
|
|
||||||
extern int __register_atfork (void (*) (void), void (*) (void), void (*) (void), void *);
|
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))
|
static int __app_register_atfork (void (*prepare) (void), void (*parent) (void), void (*child) (void))
|
||||||
{
|
{
|
||||||
return __register_atfork (prepare, parent, child,
|
return __register_atfork (prepare, parent, child, __dso_handle);
|
||||||
&__dso_handle == NULL ? NULL : __dso_handle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Number of forks seen. */
|
/* Number of forks seen. */
|
||||||
|
@ -33,18 +33,14 @@
|
|||||||
<http://www.gnu.org/licenses/>. */
|
<http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <dso_handle.h>
|
||||||
#include "exit.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 `quick_exit'. */
|
/* Register FUNC to be executed by `quick_exit'. */
|
||||||
int
|
int
|
||||||
attribute_hidden
|
attribute_hidden
|
||||||
at_quick_exit (void (*func) (void))
|
at_quick_exit (void (*func) (void))
|
||||||
{
|
{
|
||||||
return __cxa_at_quick_exit ((void (*) (void *)) func,
|
return __cxa_at_quick_exit ((void (*) (void *)) func, __dso_handle);
|
||||||
&__dso_handle == NULL ? NULL : __dso_handle);
|
|
||||||
}
|
}
|
||||||
|
@ -33,13 +33,9 @@
|
|||||||
<http://www.gnu.org/licenses/>. */
|
<http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <dso_handle.h>
|
||||||
#include "exit.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'. */
|
/* Register FUNC to be executed by `exit'. */
|
||||||
int
|
int
|
||||||
#ifndef atexit
|
#ifndef atexit
|
||||||
@ -47,6 +43,5 @@ attribute_hidden
|
|||||||
#endif
|
#endif
|
||||||
atexit (void (*func) (void))
|
atexit (void (*func) (void))
|
||||||
{
|
{
|
||||||
return __cxa_atexit ((void (*) (void *)) func, NULL,
|
return __cxa_atexit ((void (*) (void *)) func, NULL, __dso_handle);
|
||||||
&__dso_handle == NULL ? NULL : __dso_handle);
|
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,7 @@
|
|||||||
<http://www.gnu.org/licenses/>. */
|
<http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <dso_handle.h>
|
||||||
extern void *__dso_handle;
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user