elf: Remove LD_PROFILE for static binaries
[glibc.git] / elf / loadfail.c
blob7531aa958e7fb3c16f3e9fc0e296bc43033e8724
1 #include <dlfcn.h>
2 #include <error.h>
3 #include <mcheck.h>
4 #include <stdio.h>
5 #include <stdlib.h>
7 int
8 main (void)
10 void *su[5];
11 void *h;
12 int n;
14 mtrace ();
16 if ((su[0] = dlopen ("testobj1.so", RTLD_GLOBAL | RTLD_NOW)) == NULL
17 || (su[1] = dlopen ("testobj2.so", RTLD_GLOBAL | RTLD_NOW)) == NULL
18 || (su[2] = dlopen ("testobj3.so", RTLD_GLOBAL | RTLD_NOW)) == NULL
19 || (su[3] = dlopen ("testobj4.so", RTLD_GLOBAL | RTLD_NOW)) == NULL
20 || (su[4] = dlopen ("testobj5.so", RTLD_GLOBAL | RTLD_NOW)) == NULL)
21 error (EXIT_FAILURE, 0, "failed to load shared object: %s", dlerror ());
23 h = dlopen ("failobj.so", RTLD_GLOBAL | RTLD_NOW);
25 printf ("h = %p, %s\n", h, h == NULL ? "ok" : "fail");
27 for (n = 0; n < 5; ++n)
28 if (dlclose (su[n]) != 0)
30 printf ("failed to unload su[%d]: %s\n", n, dlerror ());
31 exit (EXIT_FAILURE);
34 return h != NULL;
37 extern int foo (int a);
38 int
39 foo (int a)
41 return 10;