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
--- a/src/gcc/config/alpha/linux.h
36
+++ b/src/gcc/config/alpha/linux.h
37
@@ -33,6 +33,16 @@ along with GCC; see the file COPYING3.
38
builtin_define ("_GNU_SOURCE"); \
41
+#undef TARGET_OS_D_BUILTINS
42
+#define TARGET_OS_D_BUILTINS() \
45
+ builtin_define ("GNU_GLibc"); \
47
+ builtin_define ("linux"); \
48
+ builtin_define ("Posix"); \
53
"%{pthread:-lpthread} \
54
--- a/src/gcc/config/arm/linux-eabi.h
55
+++ b/src/gcc/config/arm/linux-eabi.h
60
+#undef TARGET_OS_D_BUILTINS
61
+#define TARGET_OS_D_BUILTINS() \
64
+ TARGET_GENERIC_LINUX_OS_D_BUILTINS(); \
65
+ ANDROID_TARGET_OS_D_BUILTINS(); \
69
/* We default to a soft-float ABI so that binaries can run on all
70
target hardware. If you override this to use the hard-float ABI then
71
change the setting of GLIBC_DYNAMIC_LINKER_DEFAULT as well. */
72
--- a/src/gcc/config/darwin.h
73
+++ b/src/gcc/config/darwin.h
74
@@ -921,4 +921,10 @@ extern void darwin_driver_init (unsigned
75
providing an osx-version-min of this unless overridden by the User. */
76
#define DEF_MIN_OSX_VERSION "10.4"
78
+#define TARGET_OS_D_BUILTINS() \
80
+ builtin_define ("OSX"); \
81
+ builtin_define ("Posix"); \
84
#endif /* CONFIG_DARWIN_H */
85
--- a/src/gcc/config/freebsd.h
86
+++ b/src/gcc/config/freebsd.h
87
@@ -32,6 +32,13 @@ along with GCC; see the file COPYING3.
88
#undef TARGET_OS_CPP_BUILTINS
89
#define TARGET_OS_CPP_BUILTINS() FBSD_TARGET_OS_CPP_BUILTINS()
91
+#undef TARGET_OS_D_BUILTINS
92
+#define TARGET_OS_D_BUILTINS() \
94
+ builtin_define ("FreeBSD"); \
95
+ builtin_define ("Posix"); \
99
#define CPP_SPEC FBSD_CPP_SPEC
101
--- a/src/gcc/config/gnu.h
102
+++ b/src/gcc/config/gnu.h
103
@@ -39,3 +39,11 @@ along with GCC. If not, see <http://www
104
builtin_assert ("system=unix"); \
105
builtin_assert ("system=posix"); \
108
+#undef TARGET_OS_D_BUILTINS
109
+#define TARGET_OS_D_BUILTINS() \
112
+ builtin_define ("Hurd"); \
113
+ builtin_define ("Posix"); \
115
--- a/src/gcc/config/i386/cygwin.h
116
+++ b/src/gcc/config/i386/cygwin.h
117
@@ -20,6 +20,13 @@ along with GCC; see the file COPYING3.
119
#define EXTRA_OS_CPP_BUILTINS() /* Nothing. */
121
+#define TARGET_OS_D_BUILTINS() \
123
+ builtin_define ("Windows"); \
124
+ builtin_define ("Cygwin"); \
125
+ builtin_define ("Posix"); \
129
#define CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} \
130
-D__CYGWIN32__ -D__CYGWIN__ %{!ansi:-Dunix} -D__unix__ -D__unix \
131
--- a/src/gcc/config/i386/linux-common.h
132
+++ b/src/gcc/config/i386/linux-common.h
133
@@ -27,6 +27,15 @@ along with GCC; see the file COPYING3.
137
+#undef TARGET_OS_D_BUILTINS
138
+#define TARGET_OS_D_BUILTINS() \
141
+ TARGET_GENERIC_LINUX_OS_D_BUILTINS(); \
142
+ ANDROID_TARGET_OS_D_BUILTINS(); \
148
LINUX_OR_ANDROID_CC (GNU_USER_TARGET_CC1_SPEC, \
149
--- a/src/gcc/config/i386/mingw32.h
150
+++ b/src/gcc/config/i386/mingw32.h
151
@@ -53,6 +53,18 @@ along with GCC; see the file COPYING3.
155
+#define TARGET_OS_D_BUILTINS() TARGET_GENERIC_MINGW_OS_D_BUILTINS()
156
+#define TARGET_GENERIC_MINGW_OS_D_BUILTINS() \
158
+ builtin_define ("Windows"); \
159
+ builtin_define ("MinGW"); \
161
+ if (TARGET_64BIT && ix86_abi == MS_ABI) \
162
+ builtin_define ("Win64"); \
163
+ else if (!TARGET_64BIT) \
164
+ builtin_define ("Win32"); \
167
#ifndef TARGET_USE_PTHREAD_BY_DEFAULT
168
#define SPEC_PTHREAD1 "pthread"
169
#define SPEC_PTHREAD2 "!no-pthread"
170
--- a/src/gcc/config/i386/mingw-w64.h
171
+++ b/src/gcc/config/i386/mingw-w64.h
172
@@ -84,3 +84,10 @@ along with GCC; see the file COPYING3.
173
%{static:-Bstatic} %{!static:-Bdynamic} \
174
%{shared|mdll: " SUB_LINK_ENTRY " --enable-auto-image-base} \
175
%(shared_libgcc_undefs)"
177
+#undef TARGET_OS_D_BUILTINS
178
+#define TARGET_OS_D_BUILTINS() \
180
+ TARGET_GENERIC_MINGW_OS_D_BUILTINS(); \
181
+ builtin_define ("GNU_MinGW64"); \
183
--- a/src/gcc/config/kfreebsd-gnu.h
184
+++ b/src/gcc/config/kfreebsd-gnu.h
185
@@ -29,6 +29,14 @@ along with GCC; see the file COPYING3.
189
+#undef TARGET_OS_D_BUILTINS
190
+#define TARGET_OS_D_BUILTINS() \
192
+ builtin_define ("FreeBSD"); \
193
+ builtin_define ("Posix"); \
194
+ builtin_define ("GNU_GLibc"); \
197
#define GNU_USER_DYNAMIC_LINKER GLIBC_DYNAMIC_LINKER
198
#define GNU_USER_DYNAMIC_LINKER32 GLIBC_DYNAMIC_LINKER32
199
#define GNU_USER_DYNAMIC_LINKER64 GLIBC_DYNAMIC_LINKER64
200
--- a/src/gcc/config/knetbsd-gnu.h
201
+++ b/src/gcc/config/knetbsd-gnu.h
202
@@ -30,6 +30,16 @@ along with GCC; see the file COPYING3.
206
+#undef TARGET_OS_D_BUILTINS
207
+#define TARGET_OS_D_BUILTINS() \
210
+ builtin_define ("NetBSD"); \
211
+ builtin_define ("Posix"); \
212
+ builtin_define ("GNU_GLibc"); \
217
#undef GNU_USER_DYNAMIC_LINKER
218
#define GNU_USER_DYNAMIC_LINKER "/lib/ld.so.1"
219
--- a/src/gcc/config/kopensolaris-gnu.h
220
+++ b/src/gcc/config/kopensolaris-gnu.h
221
@@ -30,5 +30,15 @@ along with GCC; see the file COPYING3.
225
+#define TARGET_OS_D_BUILTINS() \
228
+ builtin_define ("Solaris"); \
229
+ builtin_define ("Posix"); \
230
+ builtin_define ("GNU_OpenSolaris"); \
231
+ builtin_define ("GNU_GLibc"); \
235
#undef GNU_USER_DYNAMIC_LINKER
236
#define GNU_USER_DYNAMIC_LINKER "/lib/ld.so.1"
237
--- a/src/gcc/config/linux-android.h
238
+++ b/src/gcc/config/linux-android.h
240
builtin_define ("__ANDROID__"); \
243
+#define ANDROID_TARGET_OS_D_BUILTINS() \
245
+ if (TARGET_ANDROID) \
246
+ builtin_define ("Android"); \
250
# define NOANDROID "mno-android"
252
--- a/src/gcc/config/linux.h
253
+++ b/src/gcc/config/linux.h
254
@@ -49,6 +49,20 @@ see the files COPYING3 and COPYING.RUNTI
255
builtin_assert ("system=posix"); \
258
+#define TARGET_OS_D_BUILTINS() TARGET_GENERIC_LINUX_OS_D_BUILTINS()
259
+#define TARGET_GENERIC_LINUX_OS_D_BUILTINS() \
261
+ if (OPTION_GLIBC) \
262
+ builtin_define ("GNU_GLibc"); \
263
+ else if (OPTION_UCLIBC) \
264
+ builtin_define ("GNU_UCLibc"); \
265
+ else if (OPTION_BIONIC) \
266
+ builtin_define ("GNU_Bionic"); \
268
+ builtin_define ("linux"); \
269
+ builtin_define ("Posix"); \
272
/* Determine which dynamic linker to use depending on whether GLIBC or
273
uClibc or Bionic is the default C library and whether
274
-muclibc or -mglibc or -mbionic has been passed to change the default. */
275
--- a/src/gcc/config/mips/linux-common.h
276
+++ b/src/gcc/config/mips/linux-common.h
277
@@ -27,6 +27,15 @@ along with GCC; see the file COPYING3.
278
ANDROID_TARGET_OS_CPP_BUILTINS(); \
281
+#undef TARGET_OS_D_BUILTINS
282
+#define TARGET_OS_D_BUILTINS() \
285
+ TARGET_GENERIC_LINUX_OS_D_BUILTINS(); \
286
+ ANDROID_TARGET_OS_D_BUILTINS(); \
292
LINUX_OR_ANDROID_LD (GNU_USER_TARGET_LINK_SPEC, \
293
--- a/src/gcc/config/netbsd.h
294
+++ b/src/gcc/config/netbsd.h
295
@@ -29,6 +29,14 @@ along with GCC; see the file COPYING3.
299
+#define TARGET_OS_D_BUILTINS() \
302
+ builtin_define ("NetBSD"); \
303
+ builtin_define ("Posix"); \
307
/* CPP_SPEC parts common to all NetBSD targets. */
308
#define NETBSD_CPP_SPEC \
309
"%{posix:-D_POSIX_SOURCE} \
310
--- a/src/gcc/config/openbsd.h
311
+++ b/src/gcc/config/openbsd.h
312
@@ -84,6 +84,14 @@ along with GCC; see the file COPYING3.
316
+#define TARGET_OS_D_BUILTINS() \
319
+ builtin_define ("OpenBSD"); \
320
+ builtin_define ("Posix"); \
324
/* TARGET_OS_CPP_BUILTINS() common to all OpenBSD ELF targets. */
325
#define OPENBSD_OS_CPP_BUILTINS_ELF() \
327
--- a/src/gcc/config/rs6000/aix.h
328
+++ b/src/gcc/config/rs6000/aix.h
333
+#define TARGET_OS_D_BUILTINS() \
336
+ builtin_define ("AIX"); \
337
+ builtin_define ("Posix"); \
340
/* Define appropriate architecture macros for preprocessor depending on
343
--- a/src/gcc/config/rs6000/linux64.h
344
+++ b/src/gcc/config/rs6000/linux64.h
345
@@ -333,6 +333,17 @@ extern int dot_symbols;
349
+#undef TARGET_OS_D_BUILTINS
350
+#define TARGET_OS_D_BUILTINS() \
353
+ builtin_define ("linux"); \
354
+ builtin_define ("Posix"); \
355
+ if (OPTION_GLIBC) \
356
+ builtin_define ("GNU_GLibc"); \
360
#undef CPP_OS_DEFAULT_SPEC
361
#define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"
363
--- a/src/gcc/config/rs6000/linux.h
364
+++ b/src/gcc/config/rs6000/linux.h
369
+#undef TARGET_OS_D_BUILTINS
370
+#define TARGET_OS_D_BUILTINS() \
373
+ builtin_define ("linux"); \
374
+ builtin_define ("Posix"); \
375
+ if (OPTION_GLIBC) \
376
+ builtin_define ("GNU_GLibc"); \
380
#undef CPP_OS_DEFAULT_SPEC
381
#define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"