aboutsummaryrefslogtreecommitdiff
path: root/elf/constload2.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/constload2.c')
-rw-r--r--elf/constload2.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/elf/constload2.c b/elf/constload2.c
index f109838cb8..d20e6dcbb8 100644
--- a/elf/constload2.c
+++ b/elf/constload2.c
@@ -1,4 +1,6 @@
#include <dlfcn.h>
+#include <stdio.h>
+#include <stdlib.h>
extern int bar (void);
@@ -21,4 +23,24 @@ __attribute__ ((__constructor__))
init (void)
{
h = dlopen ("constload3.so", RTLD_GLOBAL | RTLD_LAZY);
+ if (h == NULL)
+ {
+ puts ("failed to load constload3");
+ exit (1);
+ }
+ else
+ puts ("succeeded loading constload3");
+}
+
+static void
+__attribute__ ((__destructor__))
+fini (void)
+{
+ if (dlclose (h) != 0)
+ {
+ puts ("failed to unload constload3");
+ exit (1);
+ }
+ else
+ puts ("succeeded unloading constload3");
}