about summary refs log tree commit diff
path: root/elf/tst-dlmopen1mod.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/tst-dlmopen1mod.c')
-rw-r--r--elf/tst-dlmopen1mod.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/elf/tst-dlmopen1mod.c b/elf/tst-dlmopen1mod.c
index 40a4c8fa44..142488098a 100644
--- a/elf/tst-dlmopen1mod.c
+++ b/elf/tst-dlmopen1mod.c
@@ -3,6 +3,16 @@
 #include <gnu/lib-names.h>
 
 
+static int cnt;
+
+static void
+__attribute ((constructor))
+constr (void)
+{
+  ++cnt;
+}
+
+
 int
 foo (Lmid_t ns2)
 {
@@ -34,5 +44,16 @@ foo (Lmid_t ns2)
       return 1;
     }
 
+  if (cnt == 0)
+    {
+      puts ("constructor did not run");
+      return 1;
+    }
+  else if (cnt != 1)
+    {
+      puts ("constructor did not run exactly once");
+      return 1;
+    }
+
   return 0;
 }