]>
Commit | Line | Data |
---|---|---|
ca652f86 IB |
1 | /* Cygwin support needed only by D front-end. |
2 | Copyright (C) 2021-2022 Free Software Foundation, Inc. | |
b4c522fa IB |
3 | |
4 | GCC is free software; you can redistribute it and/or modify it under | |
5 | the terms of the GNU General Public License as published by the Free | |
6 | Software Foundation; either version 3, or (at your option) any later | |
7 | version. | |
8 | ||
9 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY | |
10 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 | for more details. | |
13 | ||
14 | You should have received a copy of the GNU General Public License | |
15 | along with GCC; see the file COPYING3. If not see | |
16 | <http://www.gnu.org/licenses/>. */ | |
17 | ||
ca652f86 IB |
18 | #define IN_TARGET_CODE 1 |
19 | ||
b4c522fa IB |
20 | #include "config.h" |
21 | #include "system.h" | |
22 | #include "coretypes.h" | |
ca652f86 | 23 | #include "target.h" |
d5ad6f84 | 24 | #include "tm_d.h" |
b4c522fa IB |
25 | #include "d/d-target.h" |
26 | #include "d/d-target-def.h" | |
27 | ||
ca652f86 | 28 | /* Implement TARGET_D_OS_VERSIONS for Cygwin targets. */ |
b4c522fa IB |
29 | |
30 | static void | |
ca652f86 | 31 | cygwin_d_os_builtins (void) |
b4c522fa | 32 | { |
ca652f86 IB |
33 | d_add_builtin_version ("Windows"); |
34 | d_add_builtin_version ("Cygwin"); | |
b4c522fa | 35 | d_add_builtin_version ("Posix"); |
ca652f86 | 36 | d_add_builtin_version ("CRuntime_Newlib"); |
b4c522fa IB |
37 | } |
38 | ||
d81bc495 IB |
39 | /* Handle a call to `__traits(getTargetInfo, "objectFormat")'. */ |
40 | ||
41 | static tree | |
ca652f86 | 42 | cygwin_d_handle_target_object_format (void) |
d81bc495 | 43 | { |
ca652f86 | 44 | const char *objfmt = "coff"; |
d81bc495 IB |
45 | |
46 | return build_string_literal (strlen (objfmt) + 1, objfmt); | |
47 | } | |
48 | ||
ca652f86 | 49 | /* Implement TARGET_D_REGISTER_OS_TARGET_INFO for Cygwin targets. */ |
d81bc495 IB |
50 | |
51 | static void | |
ca652f86 | 52 | cygwin_d_register_target_info (void) |
d81bc495 IB |
53 | { |
54 | const struct d_target_info_spec handlers[] = { | |
ca652f86 | 55 | { "objectFormat", cygwin_d_handle_target_object_format }, |
d81bc495 IB |
56 | { NULL, NULL }, |
57 | }; | |
58 | ||
59 | d_add_target_info_handlers (handlers); | |
60 | } | |
b4c522fa | 61 | #undef TARGET_D_OS_VERSIONS |
ca652f86 | 62 | #define TARGET_D_OS_VERSIONS cygwin_d_os_builtins |
b4c522fa | 63 | |
d81bc495 | 64 | #undef TARGET_D_REGISTER_OS_TARGET_INFO |
ca652f86 IB |
65 | #define TARGET_D_REGISTER_OS_TARGET_INFO cygwin_d_register_target_info |
66 | ||
ca652f86 IB |
67 | /* Define TARGET_D_TEMPLATES_ALWAYS_COMDAT for Cygwin targets. */ |
68 | ||
69 | #undef TARGET_D_TEMPLATES_ALWAYS_COMDAT | |
70 | #define TARGET_D_TEMPLATES_ALWAYS_COMDAT true | |
d81bc495 | 71 | |
b4c522fa | 72 | struct gcc_targetdm targetdm = TARGETDM_INITIALIZER; |