Add --enable-static-pie variants to x86_64, x32 and i686
[glibc.git] / elf / tst-leaks1.c
blob75bc92d25f99300b62363adfdb2db468276b84bd
1 #include <stdio.h>
2 #include <dlfcn.h>
3 #include <mcheck.h>
4 #include <stdlib.h>
6 static int
7 do_test (void)
9 void *h;
10 int ret = 0;
11 /* Carry out *one* failing call to dlopen before starting mtrace to
12 force any one-time inintialization that may happen to the
13 executable link map e.g. expansion and caching of $ORIGIN. */
14 h = dlopen ("$ORIGIN/tst-leaks1.o", RTLD_LAZY);
15 if (h != NULL)
17 puts ("dlopen unexpectedly succeeded");
18 ret = 1;
19 dlclose (h);
22 /* Start tracing and run each test 5 times to see if there are any
23 leaks in the failing dlopen. */
24 mtrace ();
26 for (int i = 0; i < 10; i++)
28 h = dlopen (i < 5
29 ? "./tst-leaks1.c"
30 : "$ORIGIN/tst-leaks1.o", RTLD_LAZY);
31 if (h != NULL)
33 puts ("dlopen unexpectedly succeeded");
34 ret = 1;
35 dlclose (h);
39 return ret;
42 #include <support/test-driver.c>