Fix ldbl-128ibm iscanonical for -mlong-double-64.
[glibc.git] / elf / tst-dlmopen1.c
blob5a05891846545f5a5c260f59ace132dba2562951
1 #include <dlfcn.h>
2 #include <stdio.h>
3 #include <gnu/lib-names.h>
5 #define TEST_SO "$ORIGIN/tst-dlmopen1mod.so"
7 static int
8 do_test (void)
10 void *h = dlopen (LIBC_SO, RTLD_LAZY|RTLD_NOLOAD);
11 if (h == NULL)
13 printf ("cannot get handle for %s: %s\n", LIBC_SO, dlerror ());
14 return 1;
17 Lmid_t ns = -10;
18 if (dlinfo (h, RTLD_DI_LMID, &ns) != 0)
20 printf ("dlinfo for %s in %s failed: %s\n",
21 LIBC_SO, __func__, dlerror ());
22 return 1;
25 if (ns != LM_ID_BASE)
27 printf ("namespace for %s not LM_ID_BASE\n", LIBC_SO);
28 return 1;
31 if (dlclose (h) != 0)
33 printf ("dlclose for %s in %s failed: %s\n",
34 LIBC_SO, __func__, dlerror ());
35 return 1;
38 h = dlmopen (LM_ID_NEWLM, TEST_SO, RTLD_LAZY);
39 if (h == NULL)
41 printf ("cannot get handle for %s: %s\n",
42 "tst-dlmopen1mod.so", dlerror ());
43 return 1;
46 ns = -10;
47 if (dlinfo (h, RTLD_DI_LMID, &ns) != 0)
49 printf ("dlinfo for %s in %s failed: %s\n",
50 "tst-dlmopen1mod.so", __func__, dlerror ());
51 return 1;
54 if (ns == LM_ID_BASE)
56 printf ("namespace for %s is LM_ID_BASE\n", TEST_SO);
57 return 1;
60 int (*fct) (Lmid_t) = dlsym (h, "foo");
61 if (fct == NULL)
63 printf ("could not find %s: %s\n", "foo", dlerror ());
64 return 1;
67 if (fct (ns) != 0)
68 return 1;
70 if (dlclose (h) != 0)
72 printf ("dlclose for %s in %s failed: %s\n",
73 TEST_SO, __func__, dlerror ());
74 return 1;
77 return 0;
80 #define TEST_FUNCTION do_test ()
81 #include "../test-skeleton.c"