1 /* Internal support stuff for complete soft float.
2    Copyright (C) 2002-2022 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 #if defined __NO_FPRS__ && !defined _SOFT_FLOAT
20 
21 # include <fenv_libc.h>
22 
23 #else
24 
25 # include <fenv.h>
26 
27 typedef union
28 {
29   fenv_t fenv;
30   unsigned int l[2];
31 } fenv_union_t;
32 
33 #endif
34 
35 extern __thread int __sim_exceptions_thread attribute_tls_model_ie;
36 libc_hidden_tls_proto (__sim_exceptions_thread, tls_model ("initial-exec"));
37 extern __thread int __sim_disabled_exceptions_thread attribute_tls_model_ie;
38 libc_hidden_tls_proto (__sim_disabled_exceptions_thread,
39 		       tls_model ("initial-exec"));
40 extern __thread int __sim_round_mode_thread attribute_tls_model_ie;
41 libc_hidden_tls_proto (__sim_round_mode_thread, tls_model ("initial-exec"));
42 
43 /* These variables were formerly global, so there are compat symbols
44    for global versions as well.  */
45 
46 #include <shlib-compat.h>
47 #define SIM_GLOBAL_COMPAT SHLIB_COMPAT (libc, GLIBC_2_3_2, GLIBC_2_19)
48 #if SIM_GLOBAL_COMPAT
49 extern int __sim_exceptions_global;
50 libc_hidden_proto (__sim_exceptions_global);
51 extern int __sim_disabled_exceptions_global ;
52 libc_hidden_proto (__sim_disabled_exceptions_global);
53 extern int __sim_round_mode_global;
54 libc_hidden_proto (__sim_round_mode_global);
55 # define SIM_COMPAT_SYMBOL(GLOBAL_NAME, NAME) \
56   compat_symbol (libc, GLOBAL_NAME, NAME, GLIBC_2_3_2)
57 # define SIM_SET_GLOBAL(GLOBAL_VAR, THREAD_VAR) ((GLOBAL_VAR) = (THREAD_VAR))
58 #else
59 # define SIM_SET_GLOBAL(GLOBAL_VAR, THREAD_VAR) ((void) 0)
60 #endif
61 
62 extern void __simulate_exceptions (int x) attribute_hidden;
63