1
# DP: Implements D OS version conditions.
3
This implements the following official versions:
21
These gdc specific versions are also implemented:
22
* GNU_MinGW64 (for mingw-w64)
23
* GNU_OpenSolaris (for opensolaris)
24
* GNU_GLibc (implemented for linux & bsd & opensolaris)
25
* GNU_UCLibc (implemented for linux)
26
* GNU_Bionic (implemented for linux)
28
These official OS versions are not implemented:
35
Index: b/src/gcc/config/alpha/linux.h
36
===================================================================
37
--- a/src/gcc/config/alpha/linux.h
38
+++ b/src/gcc/config/alpha/linux.h
39
@@ -33,6 +33,16 @@ along with GCC; see the file COPYING3.
40
builtin_define ("_GNU_SOURCE"); \
43
+#undef TARGET_OS_D_BUILTINS
44
+#define TARGET_OS_D_BUILTINS() \
47
+ builtin_define ("GNU_GLibc"); \
49
+ builtin_define ("linux"); \
50
+ builtin_define ("Posix"); \
55
"%{pthread:-lpthread} \
56
Index: b/src/gcc/config/arm/linux-eabi.h
57
===================================================================
58
--- a/src/gcc/config/arm/linux-eabi.h
59
+++ b/src/gcc/config/arm/linux-eabi.h
64
+#undef TARGET_OS_D_BUILTINS
65
+#define TARGET_OS_D_BUILTINS() \
68
+ TARGET_GENERIC_LINUX_OS_D_BUILTINS(); \
69
+ ANDROID_TARGET_OS_D_BUILTINS(); \
73
/* We default to a soft-float ABI so that binaries can run on all
74
target hardware. If you override this to use the hard-float ABI then
75
change the setting of GLIBC_DYNAMIC_LINKER_DEFAULT as well. */
76
Index: b/src/gcc/config/darwin.h
77
===================================================================
78
--- a/src/gcc/config/darwin.h
79
+++ b/src/gcc/config/darwin.h
80
@@ -921,4 +921,10 @@ extern void darwin_driver_init (unsigned
81
providing an osx-version-min of this unless overridden by the User. */
82
#define DEF_MIN_OSX_VERSION "10.4"
84
+#define TARGET_OS_D_BUILTINS() \
86
+ builtin_define ("OSX"); \
87
+ builtin_define ("Posix"); \
90
#endif /* CONFIG_DARWIN_H */
91
Index: b/src/gcc/config/freebsd.h
92
===================================================================
93
--- a/src/gcc/config/freebsd.h
94
+++ b/src/gcc/config/freebsd.h
95
@@ -32,6 +32,13 @@ along with GCC; see the file COPYING3.
96
#undef TARGET_OS_CPP_BUILTINS
97
#define TARGET_OS_CPP_BUILTINS() FBSD_TARGET_OS_CPP_BUILTINS()
99
+#undef TARGET_OS_D_BUILTINS
100
+#define TARGET_OS_D_BUILTINS() \
102
+ builtin_define ("FreeBSD"); \
103
+ builtin_define ("Posix"); \
107
#define CPP_SPEC FBSD_CPP_SPEC
109
Index: b/src/gcc/config/gnu.h
110
===================================================================
111
--- a/src/gcc/config/gnu.h
112
+++ b/src/gcc/config/gnu.h
113
@@ -39,3 +39,11 @@ along with GCC. If not, see <http://www
114
builtin_assert ("system=unix"); \
115
builtin_assert ("system=posix"); \
118
+#undef TARGET_OS_D_BUILTINS
119
+#define TARGET_OS_D_BUILTINS() \
122
+ builtin_define ("Hurd"); \
123
+ builtin_define ("Posix"); \
125
Index: b/src/gcc/config/i386/cygwin.h
126
===================================================================
127
--- a/src/gcc/config/i386/cygwin.h
128
+++ b/src/gcc/config/i386/cygwin.h
129
@@ -20,6 +20,13 @@ along with GCC; see the file COPYING3.
131
#define EXTRA_OS_CPP_BUILTINS() /* Nothing. */
133
+#define TARGET_OS_D_BUILTINS() \
135
+ builtin_define ("Windows"); \
136
+ builtin_define ("Cygwin"); \
137
+ builtin_define ("Posix"); \
141
#define CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} \
142
-D__CYGWIN32__ -D__CYGWIN__ %{!ansi:-Dunix} -D__unix__ -D__unix \
143
Index: b/src/gcc/config/i386/linux-common.h
144
===================================================================
145
--- a/src/gcc/config/i386/linux-common.h
146
+++ b/src/gcc/config/i386/linux-common.h
147
@@ -27,6 +27,15 @@ along with GCC; see the file COPYING3.
151
+#undef TARGET_OS_D_BUILTINS
152
+#define TARGET_OS_D_BUILTINS() \
155
+ TARGET_GENERIC_LINUX_OS_D_BUILTINS(); \
156
+ ANDROID_TARGET_OS_D_BUILTINS(); \
162
LINUX_OR_ANDROID_CC (GNU_USER_TARGET_CC1_SPEC, \
163
Index: b/src/gcc/config/i386/mingw32.h
164
===================================================================
165
--- a/src/gcc/config/i386/mingw32.h
166
+++ b/src/gcc/config/i386/mingw32.h
167
@@ -53,6 +53,18 @@ along with GCC; see the file COPYING3.
171
+#define TARGET_OS_D_BUILTINS() TARGET_GENERIC_MINGW_OS_D_BUILTINS()
172
+#define TARGET_GENERIC_MINGW_OS_D_BUILTINS() \
174
+ builtin_define ("Windows"); \
175
+ builtin_define ("MinGW"); \
177
+ if (TARGET_64BIT && ix86_abi == MS_ABI) \
178
+ builtin_define ("Win64"); \
179
+ else if (!TARGET_64BIT) \
180
+ builtin_define ("Win32"); \
183
#ifndef TARGET_USE_PTHREAD_BY_DEFAULT
184
#define SPEC_PTHREAD1 "pthread"
185
#define SPEC_PTHREAD2 "!no-pthread"
186
Index: b/src/gcc/config/i386/mingw-w64.h
187
===================================================================
188
--- a/src/gcc/config/i386/mingw-w64.h
189
+++ b/src/gcc/config/i386/mingw-w64.h
190
@@ -84,3 +84,10 @@ along with GCC; see the file COPYING3.
191
%{static:-Bstatic} %{!static:-Bdynamic} \
192
%{shared|mdll: " SUB_LINK_ENTRY " --enable-auto-image-base} \
193
%(shared_libgcc_undefs)"
195
+#undef TARGET_OS_D_BUILTINS
196
+#define TARGET_OS_D_BUILTINS() \
198
+ TARGET_GENERIC_MINGW_OS_D_BUILTINS(); \
199
+ builtin_define ("GNU_MinGW64"); \
201
Index: b/src/gcc/config/kfreebsd-gnu.h
202
===================================================================
203
--- a/src/gcc/config/kfreebsd-gnu.h
204
+++ b/src/gcc/config/kfreebsd-gnu.h
205
@@ -29,6 +29,14 @@ along with GCC; see the file COPYING3.
209
+#undef TARGET_OS_D_BUILTINS
210
+#define TARGET_OS_D_BUILTINS() \
212
+ builtin_define ("FreeBSD"); \
213
+ builtin_define ("Posix"); \
214
+ builtin_define ("GNU_GLibc"); \
217
#define GNU_USER_DYNAMIC_LINKER GLIBC_DYNAMIC_LINKER
218
#define GNU_USER_DYNAMIC_LINKER32 GLIBC_DYNAMIC_LINKER32
219
#define GNU_USER_DYNAMIC_LINKER64 GLIBC_DYNAMIC_LINKER64
220
Index: b/src/gcc/config/knetbsd-gnu.h
221
===================================================================
222
--- a/src/gcc/config/knetbsd-gnu.h
223
+++ b/src/gcc/config/knetbsd-gnu.h
224
@@ -30,6 +30,16 @@ along with GCC; see the file COPYING3.
228
+#undef TARGET_OS_D_BUILTINS
229
+#define TARGET_OS_D_BUILTINS() \
232
+ builtin_define ("NetBSD"); \
233
+ builtin_define ("Posix"); \
234
+ builtin_define ("GNU_GLibc"); \
239
#undef GNU_USER_DYNAMIC_LINKER
240
#define GNU_USER_DYNAMIC_LINKER "/lib/ld.so.1"
241
Index: b/src/gcc/config/kopensolaris-gnu.h
242
===================================================================
243
--- a/src/gcc/config/kopensolaris-gnu.h
244
+++ b/src/gcc/config/kopensolaris-gnu.h
245
@@ -30,5 +30,15 @@ along with GCC; see the file COPYING3.
249
+#define TARGET_OS_D_BUILTINS() \
252
+ builtin_define ("Solaris"); \
253
+ builtin_define ("Posix"); \
254
+ builtin_define ("GNU_OpenSolaris"); \
255
+ builtin_define ("GNU_GLibc"); \
259
#undef GNU_USER_DYNAMIC_LINKER
260
#define GNU_USER_DYNAMIC_LINKER "/lib/ld.so.1"
261
Index: b/src/gcc/config/linux-android.h
262
===================================================================
263
--- a/src/gcc/config/linux-android.h
264
+++ b/src/gcc/config/linux-android.h
266
builtin_define ("__ANDROID__"); \
269
+#define ANDROID_TARGET_OS_D_BUILTINS() \
271
+ if (TARGET_ANDROID) \
272
+ builtin_define ("Android"); \
276
# define NOANDROID "mno-android"
278
Index: b/src/gcc/config/linux.h
279
===================================================================
280
--- a/src/gcc/config/linux.h
281
+++ b/src/gcc/config/linux.h
282
@@ -49,6 +49,20 @@ see the files COPYING3 and COPYING.RUNTI
283
builtin_assert ("system=posix"); \
286
+#define TARGET_OS_D_BUILTINS() TARGET_GENERIC_LINUX_OS_D_BUILTINS()
287
+#define TARGET_GENERIC_LINUX_OS_D_BUILTINS() \
289
+ if (OPTION_GLIBC) \
290
+ builtin_define ("GNU_GLibc"); \
291
+ else if (OPTION_UCLIBC) \
292
+ builtin_define ("GNU_UCLibc"); \
293
+ else if (OPTION_BIONIC) \
294
+ builtin_define ("GNU_Bionic"); \
296
+ builtin_define ("linux"); \
297
+ builtin_define ("Posix"); \
300
/* Determine which dynamic linker to use depending on whether GLIBC or
301
uClibc or Bionic is the default C library and whether
302
-muclibc or -mglibc or -mbionic has been passed to change the default. */
303
Index: b/src/gcc/config/mips/linux-common.h
304
===================================================================
305
--- a/src/gcc/config/mips/linux-common.h
306
+++ b/src/gcc/config/mips/linux-common.h
307
@@ -27,6 +27,15 @@ along with GCC; see the file COPYING3.
308
ANDROID_TARGET_OS_CPP_BUILTINS(); \
311
+#undef TARGET_OS_D_BUILTINS
312
+#define TARGET_OS_D_BUILTINS() \
315
+ TARGET_GENERIC_LINUX_OS_D_BUILTINS(); \
316
+ ANDROID_TARGET_OS_D_BUILTINS(); \
322
LINUX_OR_ANDROID_LD (GNU_USER_TARGET_LINK_SPEC, \
323
Index: b/src/gcc/config/netbsd.h
324
===================================================================
325
--- a/src/gcc/config/netbsd.h
326
+++ b/src/gcc/config/netbsd.h
327
@@ -29,6 +29,14 @@ along with GCC; see the file COPYING3.
331
+#define TARGET_OS_D_BUILTINS() \
334
+ builtin_define ("NetBSD"); \
335
+ builtin_define ("Posix"); \
339
/* CPP_SPEC parts common to all NetBSD targets. */
340
#define NETBSD_CPP_SPEC \
341
"%{posix:-D_POSIX_SOURCE} \
342
Index: b/src/gcc/config/openbsd.h
343
===================================================================
344
--- a/src/gcc/config/openbsd.h
345
+++ b/src/gcc/config/openbsd.h
346
@@ -84,6 +84,14 @@ along with GCC; see the file COPYING3.
350
+#define TARGET_OS_D_BUILTINS() \
353
+ builtin_define ("OpenBSD"); \
354
+ builtin_define ("Posix"); \
358
/* TARGET_OS_CPP_BUILTINS() common to all OpenBSD ELF targets. */
359
#define OPENBSD_OS_CPP_BUILTINS_ELF() \
361
Index: b/src/gcc/config/rs6000/aix.h
362
===================================================================
363
--- a/src/gcc/config/rs6000/aix.h
364
+++ b/src/gcc/config/rs6000/aix.h
369
+#define TARGET_OS_D_BUILTINS() \
372
+ builtin_define ("AIX"); \
373
+ builtin_define ("Posix"); \
376
/* Define appropriate architecture macros for preprocessor depending on
379
Index: b/src/gcc/config/rs6000/linux64.h
380
===================================================================
381
--- a/src/gcc/config/rs6000/linux64.h
382
+++ b/src/gcc/config/rs6000/linux64.h
383
@@ -339,6 +339,17 @@ extern int dot_symbols;
387
+#undef TARGET_OS_D_BUILTINS
388
+#define TARGET_OS_D_BUILTINS() \
391
+ builtin_define ("linux"); \
392
+ builtin_define ("Posix"); \
393
+ if (OPTION_GLIBC) \
394
+ builtin_define ("GNU_GLibc"); \
398
#undef CPP_OS_DEFAULT_SPEC
399
#define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"
401
Index: b/src/gcc/config/rs6000/linux.h
402
===================================================================
403
--- a/src/gcc/config/rs6000/linux.h
404
+++ b/src/gcc/config/rs6000/linux.h
409
+#undef TARGET_OS_D_BUILTINS
410
+#define TARGET_OS_D_BUILTINS() \
413
+ builtin_define ("linux"); \
414
+ builtin_define ("Posix"); \
415
+ if (OPTION_GLIBC) \
416
+ builtin_define ("GNU_GLibc"); \
420
#undef CPP_OS_DEFAULT_SPEC
421
#define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"