1 /* Link-time constants for ARM EABI.
2 Copyright (C) 2005-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 In addition to the permissions in the GNU Lesser General Public
11 License, the Free Software Foundation gives you unlimited
12 permission to link the compiled version of this file with other
13 programs, and to distribute those programs without any restriction
14 coming from the use of this file. (The GNU Lesser General Public
15 License restrictions do apply in other respects; for example, they
16 cover modification of the file, and distribution when not linked
17 into another program.)
18
19 Note that people who make modified versions of this file are not
20 obligated to grant this special exception for their modified
21 versions; it is their choice whether to do so. The GNU Lesser
22 General Public License gives permission to release a modified
23 version without this exception; this exception also makes it
24 possible to release a modified version which carries forward this
25 exception.
26
27 The GNU C Library is distributed in the hope that it will be useful,
28 but WITHOUT ANY WARRANTY; without even the implied warranty of
29 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30 Lesser General Public License for more details.
31
32 You should have received a copy of the GNU Lesser General Public
33 License along with the GNU C Library. If not, see
34 <https://www.gnu.org/licenses/>. */
35
36 /* The ARM EABI requires that we provide ISO compile-time constants as
37 link-time constants. Some portable applications may reference these. */
38
39 #include <errno.h>
40 #include <limits.h>
41 #include <locale.h>
42 #include <setjmp.h>
43 #include <signal.h>
44 #include <stdio.h>
45 #include <time.h>
46
47 #define eabi_constant2(X,Y) const int __aeabi_##X attribute_hidden = Y
48 #define eabi_constant(X) const int __aeabi_##X attribute_hidden = X
49
50 eabi_constant (EDOM);
51 eabi_constant (ERANGE);
52 eabi_constant (EILSEQ);
53
54 eabi_constant (MB_LEN_MAX);
55
56 eabi_constant (LC_COLLATE);
57 eabi_constant (LC_CTYPE);
58 eabi_constant (LC_MONETARY);
59 eabi_constant (LC_NUMERIC);
60 eabi_constant (LC_TIME);
61 eabi_constant (LC_ALL);
62
63 /* The value of __aeabi_JMP_BUF_SIZE is the number of doublewords in a
64 jmp_buf. */
65 eabi_constant2 (JMP_BUF_SIZE, sizeof (jmp_buf) / 8);
66
67 eabi_constant (SIGABRT);
68 eabi_constant (SIGFPE);
69 eabi_constant (SIGILL);
70 eabi_constant (SIGINT);
71 eabi_constant (SIGSEGV);
72 eabi_constant (SIGTERM);
73
74 eabi_constant2 (IOFBF, _IOFBF);
75 eabi_constant2 (IOLBF, _IOLBF);
76 eabi_constant2 (IONBF, _IONBF);
77 eabi_constant (BUFSIZ);
78 eabi_constant (FOPEN_MAX);
79 eabi_constant (TMP_MAX);
80 eabi_constant (FILENAME_MAX);
81 eabi_constant (L_tmpnam);
82
83 FILE *__aeabi_stdin attribute_hidden;
84 FILE *__aeabi_stdout attribute_hidden;
85 FILE *__aeabi_stderr attribute_hidden;
86
87 static void __attribute__ ((used))
setup_aeabi_stdio(void)88 setup_aeabi_stdio (void)
89 {
90 __aeabi_stdin = stdin;
91 __aeabi_stdout = stdout;
92 __aeabi_stderr = stderr;
93 }
94
95 static void (*fp) (void) __attribute__ ((used, section (".preinit_array")))
96 = setup_aeabi_stdio;
97
98 eabi_constant (CLOCKS_PER_SEC);
99