Mercurial > hg > CbC > CbC_gcc
annotate gcc/config/linux.h @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
rev | line source |
---|---|
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1 /* Definitions for systems using the Linux kernel, with or without |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2 MMU, using ELF at the compiler level but possibly FLT for final |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3 linked executables and shared libraries in some no-MMU cases, and |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
4 possibly with a choice of libc implementations. |
145 | 5 Copyright (C) 1995-2020 Free Software Foundation, Inc. |
0 | 6 Contributed by Eric Youngdale. |
7 Modified for stabs-in-ELF by H.J. Lu (hjl@lucon.org). | |
8 | |
9 This file is part of GCC. | |
10 | |
11 GCC is free software; you can redistribute it and/or modify | |
12 it under the terms of the GNU General Public License as published by | |
13 the Free Software Foundation; either version 3, or (at your option) | |
14 any later version. | |
15 | |
16 GCC is distributed in the hope that it will be useful, | |
17 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 GNU General Public License for more details. | |
20 | |
21 Under Section 7 of GPL version 3, you are granted additional | |
22 permissions described in the GCC Runtime Library Exception, version | |
23 3.1, as published by the Free Software Foundation. | |
24 | |
25 You should have received a copy of the GNU General Public License and | |
26 a copy of the GCC Runtime Library Exception along with this program; | |
27 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | |
28 <http://www.gnu.org/licenses/>. */ | |
29 | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
30 /* C libraries supported on Linux. */ |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
31 #ifdef SINGLE_LIBC |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
32 #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC) |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
33 #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC) |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
34 #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC) |
111 | 35 #undef OPTION_MUSL |
36 #define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL) | |
0 | 37 #else |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
38 #define OPTION_GLIBC (linux_libc == LIBC_GLIBC) |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
39 #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC) |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
40 #define OPTION_BIONIC (linux_libc == LIBC_BIONIC) |
111 | 41 #undef OPTION_MUSL |
42 #define OPTION_MUSL (linux_libc == LIBC_MUSL) | |
0 | 43 #endif |
44 | |
111 | 45 #define GNU_USER_TARGET_OS_CPP_BUILTINS() \ |
0 | 46 do { \ |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
47 if (OPTION_GLIBC) \ |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
48 builtin_define ("__gnu_linux__"); \ |
0 | 49 builtin_define_std ("linux"); \ |
50 builtin_define_std ("unix"); \ | |
51 builtin_assert ("system=linux"); \ | |
52 builtin_assert ("system=unix"); \ | |
53 builtin_assert ("system=posix"); \ | |
54 } while (0) | |
55 | |
145 | 56 #define GNU_USER_TARGET_D_OS_VERSIONS() \ |
57 do { \ | |
58 builtin_version ("linux"); \ | |
59 if (OPTION_GLIBC) \ | |
60 builtin_version ("CRuntime_Glibc"); \ | |
61 else if (OPTION_UCLIBC) \ | |
62 builtin_version ("CRuntime_UClibc"); \ | |
63 else if (OPTION_BIONIC) \ | |
64 builtin_version ("CRuntime_Bionic"); \ | |
65 else if (OPTION_MUSL) \ | |
66 builtin_version ("CRuntime_Musl"); \ | |
67 } while (0) | |
68 | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
69 /* Determine which dynamic linker to use depending on whether GLIBC or |
111 | 70 uClibc or Bionic or musl is the default C library and whether |
71 -muclibc or -mglibc or -mbionic or -mmusl has been passed to change | |
72 the default. */ | |
0 | 73 |
111 | 74 #define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, LD4) \ |
75 "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}" | |
0 | 76 |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
77 #if DEFAULT_LIBC == LIBC_GLIBC |
111 | 78 #define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \ |
79 CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M) | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
80 #elif DEFAULT_LIBC == LIBC_UCLIBC |
111 | 81 #define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \ |
82 CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M) | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
83 #elif DEFAULT_LIBC == LIBC_BIONIC |
111 | 84 #define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \ |
85 CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M) | |
86 #elif DEFAULT_LIBC == LIBC_MUSL | |
87 #define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \ | |
88 CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B) | |
0 | 89 #else |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
90 #error "Unsupported DEFAULT_LIBC" |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
91 #endif /* DEFAULT_LIBC */ |
0 | 92 |
93 /* For most targets the following definitions suffice; | |
94 GLIBC_DYNAMIC_LINKER must be defined for each target using them, or | |
95 GLIBC_DYNAMIC_LINKER32 and GLIBC_DYNAMIC_LINKER64 for targets | |
96 supporting both 32-bit and 64-bit compilation. */ | |
97 #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" | |
98 #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0" | |
99 #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0" | |
111 | 100 #define UCLIBC_DYNAMIC_LINKERX32 "/lib/ldx32-uClibc.so.0" |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
101 #define BIONIC_DYNAMIC_LINKER "/system/bin/linker" |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
102 #define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker" |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
103 #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64" |
111 | 104 #define BIONIC_DYNAMIC_LINKERX32 "/system/bin/linkerx32" |
105 /* Should be redefined for each target that supports musl. */ | |
106 #define MUSL_DYNAMIC_LINKER "/dev/null" | |
107 #define MUSL_DYNAMIC_LINKER32 "/dev/null" | |
108 #define MUSL_DYNAMIC_LINKER64 "/dev/null" | |
109 #define MUSL_DYNAMIC_LINKERX32 "/dev/null" | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
110 |
111 | 111 #define GNU_USER_DYNAMIC_LINKER \ |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
112 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \ |
111 | 113 BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER) |
114 #define GNU_USER_DYNAMIC_LINKER32 \ | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
115 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \ |
111 | 116 BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32) |
117 #define GNU_USER_DYNAMIC_LINKER64 \ | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
118 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \ |
111 | 119 BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64) |
120 #define GNU_USER_DYNAMIC_LINKERX32 \ | |
121 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERX32, UCLIBC_DYNAMIC_LINKERX32, \ | |
122 BIONIC_DYNAMIC_LINKERX32, MUSL_DYNAMIC_LINKERX32) | |
123 | |
124 /* Whether we have Bionic libc runtime */ | |
125 #undef TARGET_HAS_BIONIC | |
126 #define TARGET_HAS_BIONIC (OPTION_BIONIC) | |
127 | |
128 /* musl avoids problematic includes by rearranging the include directories. | |
129 * Unfortunately, this is mostly duplicated from cppdefault.c */ | |
130 #if DEFAULT_LIBC == LIBC_MUSL | |
131 #define INCLUDE_DEFAULTS_MUSL_GPP \ | |
132 { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \ | |
133 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \ | |
134 { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \ | |
135 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \ | |
136 { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \ | |
137 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, | |
138 | |
139 #ifdef LOCAL_INCLUDE_DIR | |
140 #define INCLUDE_DEFAULTS_MUSL_LOCAL \ | |
141 { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \ | |
142 { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 }, | |
143 #else | |
144 #define INCLUDE_DEFAULTS_MUSL_LOCAL | |
145 #endif | |
146 | |
147 #ifdef PREFIX_INCLUDE_DIR | |
148 #define INCLUDE_DEFAULTS_MUSL_PREFIX \ | |
149 { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0}, | |
150 #else | |
151 #define INCLUDE_DEFAULTS_MUSL_PREFIX | |
152 #endif | |
153 | |
154 #ifdef CROSS_INCLUDE_DIR | |
155 #define INCLUDE_DEFAULTS_MUSL_CROSS \ | |
156 { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0}, | |
157 #else | |
158 #define INCLUDE_DEFAULTS_MUSL_CROSS | |
159 #endif | |
160 | |
161 #ifdef TOOL_INCLUDE_DIR | |
162 #define INCLUDE_DEFAULTS_MUSL_TOOL \ | |
163 { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0}, | |
164 #else | |
165 #define INCLUDE_DEFAULTS_MUSL_TOOL | |
166 #endif | |
0 | 167 |
111 | 168 #ifdef NATIVE_SYSTEM_HEADER_DIR |
169 #define INCLUDE_DEFAULTS_MUSL_NATIVE \ | |
170 { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \ | |
171 { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 }, | |
172 #else | |
173 #define INCLUDE_DEFAULTS_MUSL_NATIVE | |
174 #endif | |
175 | |
176 #if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT) | |
177 # undef INCLUDE_DEFAULTS_MUSL_LOCAL | |
178 # define INCLUDE_DEFAULTS_MUSL_LOCAL | |
179 # undef INCLUDE_DEFAULTS_MUSL_NATIVE | |
180 # define INCLUDE_DEFAULTS_MUSL_NATIVE | |
181 #else | |
182 # undef INCLUDE_DEFAULTS_MUSL_CROSS | |
183 # define INCLUDE_DEFAULTS_MUSL_CROSS | |
184 #endif | |
0 | 185 |
111 | 186 #undef INCLUDE_DEFAULTS |
187 #define INCLUDE_DEFAULTS \ | |
188 { \ | |
189 INCLUDE_DEFAULTS_MUSL_GPP \ | |
190 INCLUDE_DEFAULTS_MUSL_LOCAL \ | |
191 INCLUDE_DEFAULTS_MUSL_PREFIX \ | |
192 INCLUDE_DEFAULTS_MUSL_CROSS \ | |
193 INCLUDE_DEFAULTS_MUSL_TOOL \ | |
194 INCLUDE_DEFAULTS_MUSL_NATIVE \ | |
195 { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \ | |
196 { 0, 0, 0, 0, 0, 0 } \ | |
197 } | |
198 #endif | |
199 | |
200 #if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */ | |
201 /* This is a *uclinux* target. We don't define below macros to normal linux | |
202 versions, because doing so would require *uclinux* targets to include | |
203 linux.c, linux-protos.h, linux.opt, etc. We could, alternatively, add | |
204 these files to *uclinux* targets, but that would only pollute option list | |
205 (add -mglibc, etc.) without adding any useful support. */ | |
206 | |
207 /* Define TARGET_LIBC_HAS_FUNCTION for *uclinux* targets to | |
208 no_c99_libc_has_function, because uclibc does not, normally, have | |
209 c99 runtime. If, in special cases, uclibc does have c99 runtime, | |
210 this should be defined to a new hook. Also please note that for targets | |
211 like *-linux-uclibc that similar check will also need to be added to | |
212 linux_libc_has_function. */ | |
213 # undef TARGET_LIBC_HAS_FUNCTION | |
214 # define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function | |
215 | |
216 #else /* !uClinux, i.e., normal Linux */ | |
217 | |
218 /* Determine what functions are present at the runtime; | |
219 this includes full c99 runtime and sincos. */ | |
220 # undef TARGET_LIBC_HAS_FUNCTION | |
221 # define TARGET_LIBC_HAS_FUNCTION linux_libc_has_function | |
222 | |
223 #endif |