1 /* GLRO(dl_pagesize) initialization DSO test with a static executable.
2 Copyright (C) 2013-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
24 /* Check that the same page size is reported both directly and by a DSO
25 mapped from a static executable.
27 On targets that support different page sizes, the kernel communicates
28 the size currently in use via the auxiliary vector. The auxiliary
29 vector and HWCAP/HWCAP2 bits are copied across the static dlopen
30 boundary in __rtld_static_init. */
34 int pagesize
= getpagesize ();
35 int (*my_getpagesize
) (void);
39 /* Try to map a module. */
40 handle
= dlopen ("modstatic5.so", RTLD_LAZY
| RTLD_LOCAL
);
43 printf ("dlopen (modstatic5.so): %s\n", dlerror ());
47 /* Get at its symbol. */
48 my_getpagesize
= dlsym (handle
, "my_getpagesize");
49 if (my_getpagesize
== NULL
)
51 printf ("dlsym (my_getpagesize): %s\n", dlerror ());
55 /* Make sure the page size reported is the same either way. */
56 my_pagesize
= my_getpagesize ();
57 if (my_pagesize
!= pagesize
)
59 printf ("my_getpagesize: got %i, expected %i\n", my_pagesize
, pagesize
);
63 /* All done, clean up. */
64 my_getpagesize
= NULL
;
70 #define TEST_FUNCTION do_test ()
71 #include "../test-skeleton.c"