packaging: Enable memcpy in sysdeps/arm/memcpy.S for ARM
[platform/upstream/glibc.git] / dlfcn / tststatic5.c
1 /* GLRO(dl_pagesize) initialization DSO test with a static executable.
2    Copyright (C) 2013-2024 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4
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.
9
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.
14
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/>.  */
18
19 #include <dlfcn.h>
20 #include <stddef.h>
21 #include <stdio.h>
22 #include <unistd.h>
23
24 /* Check that the same page size is reported both directly and by a DSO
25    mapped from a static executable.
26
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.  */
31 static int
32 do_test (void)
33 {
34   int pagesize = getpagesize ();
35   int (*my_getpagesize) (void);
36   int my_pagesize;
37   void *handle;
38
39   /* Try to map a module.  */
40   handle = dlopen ("modstatic5.so", RTLD_LAZY | RTLD_LOCAL);
41   if (handle == NULL)
42     {
43       printf ("dlopen (modstatic5.so): %s\n", dlerror ());
44       return 1;
45     }
46
47   /* Get at its symbol.  */
48   my_getpagesize = dlsym (handle, "my_getpagesize");
49   if (my_getpagesize == NULL)
50     {
51       printf ("dlsym (my_getpagesize): %s\n", dlerror ());
52       return 1;
53     }
54
55   /* Make sure the page size reported is the same either way.  */
56   my_pagesize = my_getpagesize ();
57   if (my_pagesize != pagesize)
58     {
59       printf ("my_getpagesize: got %i, expected %i\n", my_pagesize, pagesize);
60       return 1;
61     }
62
63   /* All done, clean up.  */
64   my_getpagesize = NULL;
65   dlclose (handle);
66
67   return 0;
68 }
69
70 #define TEST_FUNCTION do_test ()
71 #include "../test-skeleton.c"