Change _IO_stderr_/_IO_stdin_/_IO_stdout to compat symbols [BZ #31766]
[glibc.git] / sysdeps / powerpc / powerpc32 / power4 / multiarch / init-arch.h
blob7afbd0a2051b7fb23c3ae11042d7ef1993c380e4
1 /* This file is part of the GNU C Library.
2 Copyright (C) 2013-2024 Free Software Foundation, Inc.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
18 #include <ldsodefs.h>
19 #include <cpu-features.h>
21 /* The code checks if _rtld_global_ro was realocated before trying to access
22 the dl_hwcap field. The assembly is to make the compiler not optimize the
23 test (&_rtld_global_ro != NULL), which is always true in ISO C (but not
24 in that case since _rtld_global_ro might not been realocated yet). */
25 #if defined(SHARED) && !IS_IN (rtld)
26 # define __GLRO(value) \
27 ({ volatile void **__p = (volatile void**)(&_rtld_global_ro); \
28 unsigned long int __ret; \
29 asm ("# x in %0" : "+r" (__p)); \
30 __ret = (__p) ? GLRO(value) : 0; \
31 __ret; })
32 #else
33 # define __GLRO(value) GLRO(value)
34 #endif
36 /* Get the hardware information post the tunables set, the macro checks
37 it and fills the previous ones. */
38 #define INIT_ARCH() \
39 const struct cpu_features *features = &GLRO(dl_powerpc_cpu_features); \
40 unsigned long int hwcap = features->hwcap; \
41 unsigned long int __attribute__((unused)) hwcap2 = features->hwcap2; \
42 bool __attribute__((unused)) use_cached_memopt = \
43 __GLRO(dl_powerpc_cpu_features.use_cached_memopt); \
44 if (hwcap & PPC_FEATURE_ARCH_2_06) \
45 hwcap |= PPC_FEATURE_ARCH_2_05 | \
46 PPC_FEATURE_POWER5_PLUS | \
47 PPC_FEATURE_POWER5 | \
48 PPC_FEATURE_POWER4; \
49 else if (hwcap & PPC_FEATURE_ARCH_2_05) \
50 hwcap |= PPC_FEATURE_POWER5_PLUS | \
51 PPC_FEATURE_POWER5 | \
52 PPC_FEATURE_POWER4; \
53 else if (hwcap & PPC_FEATURE_POWER5_PLUS) \
54 hwcap |= PPC_FEATURE_POWER5 | \
55 PPC_FEATURE_POWER4; \
56 else if (hwcap & PPC_FEATURE_POWER5) \
57 hwcap |= PPC_FEATURE_POWER4;