about summary refs log tree commit diff
path: root/REORG.TODO/elf/unload6mod2.c
diff options
context:
space:
mode:
Diffstat (limited to 'REORG.TODO/elf/unload6mod2.c')
-rw-r--r--REORG.TODO/elf/unload6mod2.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/REORG.TODO/elf/unload6mod2.c b/REORG.TODO/elf/unload6mod2.c
new file mode 100644
index 0000000000..980efa4b0e
--- /dev/null
+++ b/REORG.TODO/elf/unload6mod2.c
@@ -0,0 +1,23 @@
+#include <dlfcn.h>
+#include <stdio.h>
+#include <unistd.h>
+
+static void *h;
+
+static void __attribute__((constructor))
+mod2init (void)
+{
+  h = dlopen ("unload6mod3.so", RTLD_LAZY);
+  if (h == NULL)
+    {
+      puts ("dlopen unload6mod3.so failed");
+      fflush (stdout);
+      _exit (1);
+    }
+}
+
+static void __attribute__((destructor))
+mod2fini (void)
+{
+  dlclose (h);
+}