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