m68k: update libm test ULPs
[glibc.git] / elf / lateglobal.c
blob4a1a7cd085bfaf2ccd3cd32c019b610707a12616
1 #include <dlfcn.h>
2 #include <mcheck.h>
3 #include <stdio.h>
4 #include <stdlib.h>
6 int
7 main (void)
9 void *h[2];
10 int fail;
11 int (*fp) (void);
13 mtrace ();
15 h[0] = dlopen ("ltglobmod1.so", RTLD_LAZY);
16 if (h[0] == NULL)
18 printf ("%s: cannot open %s: %s",
19 __FUNCTION__, "ltglobmod1.so", dlerror ());
20 exit (EXIT_FAILURE);
22 h[1] = dlopen ("ltglobmod2.so", RTLD_LAZY);
23 if (h[1] == NULL)
25 printf ("%s: cannot open %s: %s",
26 __FUNCTION__, "ltglobmod2.so", dlerror ());
27 exit (EXIT_FAILURE);
30 puts ("loaded \"ltglobmod1.so\" without RTLD_GLOBAL");
32 fp = dlsym (h[1], "foo");
33 if (fp == NULL)
35 printf ("cannot get address of `foo': %s", dlerror ());
36 exit (EXIT_FAILURE);
39 fail = fp ();
41 puts ("back in main");
43 dlclose (h[1]);
44 dlclose (h[0]);
46 return fail;