* dlfcn/Makefile: Add rules to build and run bug-atexit3.
authorUlrich Drepper <drepper@redhat.com>
Thu, 27 Jul 2006 01:31:43 +0000 (01:31 +0000)
committerUlrich Drepper <drepper@redhat.com>
Thu, 27 Jul 2006 01:31:43 +0000 (01:31 +0000)
* dlfcn/bug-atexit3.c: New file.
* dlfcn/bug-atexit3-lib.cc: New file.

ChangeLog
dlfcn/Makefile
dlfcn/bug-atexit3-lib.cc [new file with mode: 0644]
dlfcn/bug-atexit3.c [new file with mode: 0644]

index 2852fb1..2569313 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2006-07-26  Ulrich Drepper  <drepper@redhat.com>
 
+       * dlfcn/Makefile: Add rules to build and run bug-atexit3.
+       * dlfcn/bug-atexit3.c: New file.
+       * dlfcn/bug-atexit3-lib.cc: New file.
+
        * dlfcn/dlmopen.c (dlmopen_doit): Don't allow RTLD_GLOBAL to be
        used when the namespace is not the base namespace.
 
index bfa1815..f2ef2f7 100644 (file)
@@ -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
 
+LDFLAGS-bug-atexit3-lib.so = -lstdc++
+$(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 (file)
index 0000000..3d01ea8
--- /dev/null
@@ -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 (file)
index 0000000..897eca8
--- /dev/null
@@ -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"