x86_64: Fix missing wcsncat function definition without multiarch (x86-64-v4)
[glibc.git] / elf / tst-single_threaded.c
blobb4000c4d218d5f87879c87022567a7c152c1a2fd
1 /* Test support for single-thread optimizations. No threads.
2 Copyright (C) 2020-2024 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/>. */
19 #include <stddef.h>
20 #include <stdio.h>
21 #include <support/check.h>
22 #include <support/namespace.h>
23 #include <support/xdlfcn.h>
24 #include <sys/single_threaded.h>
26 /* Defined in tst-single-threaded-mod1.so. */
27 extern _Bool single_threaded_1 (void);
29 /* Initialized via dlsym. */
30 _Bool (*single_threaded_2) (void);
31 _Bool (*single_threaded_3) (void);
33 static void
34 subprocess (void *closure)
36 TEST_VERIFY (__libc_single_threaded);
37 TEST_VERIFY (single_threaded_1 ());
38 if (single_threaded_2 != NULL)
39 TEST_VERIFY (single_threaded_2 ());
40 if (single_threaded_3 != NULL)
41 TEST_VERIFY (!single_threaded_3 ());
44 static int
45 do_test (void)
47 TEST_VERIFY (__libc_single_threaded);
48 TEST_VERIFY (single_threaded_1 ());
49 support_isolate_in_subprocess (subprocess, NULL);
51 void *handle_mod2 = xdlopen ("tst-single_threaded-mod2.so", RTLD_LAZY);
52 single_threaded_2 = xdlsym (handle_mod2, "single_threaded_2");
53 TEST_VERIFY (single_threaded_2 ());
54 support_isolate_in_subprocess (subprocess, NULL);
56 /* The current implementation treats the inner namespace as
57 multi-threaded. */
58 void *handle_mod3 = dlmopen (LM_ID_NEWLM, "tst-single_threaded-mod3.so",
59 RTLD_LAZY);
60 single_threaded_3 = xdlsym (handle_mod3, "single_threaded_3");
61 TEST_VERIFY (!single_threaded_3 ());
62 support_isolate_in_subprocess (subprocess, NULL);
64 xdlclose (handle_mod3);
65 xdlclose (handle_mod2);
67 return 0;
70 #include <support/test-driver.c>