diff options
author | Roland McGrath <roland@gnu.org> | 2006-07-29 23:12:43 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2006-07-29 23:12:43 +0000 |
commit | ab5823b4b6e760345d347b98830ccc75aa81bff6 (patch) | |
tree | f9b25d5f9a16e7ce0318aaf3adcccec0e83fd804 /dlfcn | |
parent | aa583d2ff9fca922771d88f1afa255847f2aa4ed (diff) | |
download | glibc-ab5823b4b6e760345d347b98830ccc75aa81bff6.tar glibc-ab5823b4b6e760345d347b98830ccc75aa81bff6.tar.gz glibc-ab5823b4b6e760345d347b98830ccc75aa81bff6.tar.bz2 glibc-ab5823b4b6e760345d347b98830ccc75aa81bff6.zip |
Updated to fedora-glibc-20060729T2255cvs/fedora-glibc-2_4_90-14
Diffstat (limited to 'dlfcn')
-rw-r--r-- | dlfcn/Makefile | 13 | ||||
-rw-r--r-- | dlfcn/bug-atexit3-lib.cc | 23 | ||||
-rw-r--r-- | dlfcn/bug-atexit3.c | 18 | ||||
-rw-r--r-- | dlfcn/dlmopen.c | 17 |
4 files changed, 63 insertions, 8 deletions
diff --git a/dlfcn/Makefile b/dlfcn/Makefile index bfa181528b..649f61de63 100644 --- a/dlfcn/Makefile +++ b/dlfcn/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1995-2002, 2003, 2004, 2005 Free Software Foundation, Inc. +# Copyright (C) 1995-2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -40,7 +40,8 @@ endif ifeq (yes,$(build-shared)) tests = glrefmain failtest tst-dladdr default errmsg1 tstcxaatexit \ - bug-dlopen1 bug-dlsym1 tst-dlinfo bug-atexit1 bug-atexit2 + bug-dlopen1 bug-dlsym1 tst-dlinfo bug-atexit1 bug-atexit2 \ + bug-atexit3 ifeq (yes,$(have-protected)) tests += tstatexit endif @@ -48,7 +49,7 @@ endif modules-names = glreflib1 glreflib2 failtestmod defaultmod1 defaultmod2 \ errmsg1mod modatexit modcxaatexit \ bug-dlsym1-lib1 bug-dlsym1-lib2 bug-atexit1-lib \ - bug-atexit2-lib + bug-atexit2-lib bug-atexit3-lib failtestmod.so-no-z-defs = yes glreflib2.so-no-z-defs = yes @@ -135,6 +136,12 @@ $(objpfx)bug-atexit2.out: $(objpfx)bug-atexit2-lib.so $(objpfx)bug-atexit2-lib.so: $(common-objpfx)libc.so \ $(common-objpfx)libc_nonshared.a +LDLIBS-bug-atexit3-lib.so = -lstdc++ -lgcc_eh $(common-objpfx)libc_nonshared.a +$(objpfx)bug-atexit3: $(libdl) +$(objpfx)bug-atexit3.out: $(objpfx)bug-atexit3-lib.so +$(objpfx)bug-atexit3-lib.so: $(common-objpfx)libc.so \ + $(common-objpfx)libc_nonshared.a + # Depend on libc.so so a DT_NEEDED is generated in the shared objects. # This ensures they will load libc.so for needed symbols if loaded by diff --git a/dlfcn/bug-atexit3-lib.cc b/dlfcn/bug-atexit3-lib.cc new file mode 100644 index 0000000000..3d01ea81d2 --- /dev/null +++ b/dlfcn/bug-atexit3-lib.cc @@ -0,0 +1,23 @@ +#include <unistd.h> + +struct statclass +{ + statclass() + { + write (1, "statclass\n", 10); + } + ~statclass() + { + write (1, "~statclass\n", 11); + } +}; + +struct extclass +{ + ~extclass() + { + static statclass var; + } +}; + +extclass globvar; diff --git a/dlfcn/bug-atexit3.c b/dlfcn/bug-atexit3.c new file mode 100644 index 0000000000..897eca8a86 --- /dev/null +++ b/dlfcn/bug-atexit3.c @@ -0,0 +1,18 @@ +#include <dlfcn.h> +#include <stdio.h> + +static int +do_test (void) +{ + void *handle = dlopen ("$ORIGIN/bug-atexit3-lib.so", RTLD_LAZY); + if (handle == NULL) + { + printf ("dlopen failed: %s\n", dlerror ()); + return 1; + } + dlclose (handle); + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/dlfcn/dlmopen.c b/dlfcn/dlmopen.c index 0a6d47ea2e..0c6915493b 100644 --- a/dlfcn/dlmopen.c +++ b/dlfcn/dlmopen.c @@ -1,5 +1,5 @@ /* Load a shared object at run time. - Copyright (C) 1995,96,97,98,99,2000,2003,2004 Free Software Foundation, Inc. + Copyright (C) 1995-2000,2003,2004,2006 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -55,12 +55,19 @@ dlmopen_doit (void *a) /* Non-shared code has no support for multiple namespaces. */ if (args->nsid != LM_ID_BASE) + { # ifdef SHARED - /* If trying to open the link map for the main executable the namespace - must be the main one. */ - if (args->file == NULL) + /* If trying to open the link map for the main executable the namespace + must be the main one. */ + if (args->file == NULL) # endif - GLRO(dl_signal_error) (EINVAL, NULL, NULL, N_("invalid namespace")); + GLRO(dl_signal_error) (EINVAL, NULL, NULL, N_("invalid namespace")); + + /* It makes no sense to use RTLD_GLOBAL when loading a DSO into + a namespace other than the base namespace. */ + if (__builtin_expect (args->mode & RTLD_GLOBAL, 0)) + GLRO(dl_signal_error) (EINVAL, NULL, NULL, N_("invalid mode")); + } args->new = GLRO(dl_open) (args->file ?: "", args->mode | __RTLD_DLOPEN, args->caller, |