1 /* Darwin support needed only by D front-end.
2 Copyright (C) 2020-2021 Free Software Foundation, Inc.
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
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
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/>. */
20 #include "coretypes.h"
22 #include "d/d-target.h"
23 #include "d/d-target-def.h"
25 /* Implement TARGET_D_OS_VERSIONS for Darwin targets. */
28 darwin_d_os_builtins (void)
30 d_add_builtin_version ("Posix");
31 d_add_builtin_version ("OSX");
32 d_add_builtin_version ("darwin");
35 /* Handle a call to `__traits(getTargetInfo, "objectFormat")'. */
38 darwin_d_handle_target_object_format (void)
40 const char *objfmt
= "macho";
42 return build_string_literal (strlen (objfmt
) + 1, objfmt
);
45 /* Implement TARGET_D_REGISTER_OS_TARGET_INFO for Darwin targets. */
48 darwin_d_register_target_info (void)
50 const struct d_target_info_spec handlers
[] = {
51 { "objectFormat", darwin_d_handle_target_object_format
},
55 d_add_target_info_handlers (handlers
);
58 #undef TARGET_D_OS_VERSIONS
59 #define TARGET_D_OS_VERSIONS darwin_d_os_builtins
61 #undef TARGET_D_REGISTER_OS_TARGET_INFO
62 #define TARGET_D_REGISTER_OS_TARGET_INFO darwin_d_register_target_info
64 /* Define TARGET_D_MINFO_SECTION for Darwin targets. */
66 #undef TARGET_D_MINFO_SECTION
67 #define TARGET_D_MINFO_SECTION "__DATA,__minfodata"
69 #undef TARGET_D_MINFO_START_NAME
70 #define TARGET_D_MINFO_START_NAME "*section$start$__DATA$__minfodata"
72 #undef TARGET_D_MINFO_END_NAME
73 #define TARGET_D_MINFO_END_NAME "*section$end$__DATA$__minfodata"
75 struct gcc_targetdm targetdm
= TARGETDM_INITIALIZER
;