]>
Commit | Line | Data |
---|---|---|
b4c522fa | 1 | /* d-target.def -- Target hook definitions for the D front end. |
a945c346 | 2 | Copyright (C) 2017-2024 Free Software Foundation, Inc. |
b4c522fa IB |
3 | |
4 | This program is free software; you can redistribute it and/or modify it | |
5 | under the terms of the GNU General Public License as published by the | |
6 | Free Software Foundation; either version 3, or (at your option) any | |
7 | later version. | |
8 | ||
9 | This program is distributed in the hope that it will be useful, | |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | GNU General Public License for more details. | |
13 | ||
14 | You should have received a copy of the GNU General Public License | |
15 | along with this program; see the file COPYING3. If not see | |
16 | <http://www.gnu.org/licenses/>. */ | |
17 | ||
18 | /* See target-hooks-macros.h for details of macros that should be | |
19 | provided by the including file, and how to use them here. */ | |
20 | ||
21 | #include "target-hooks-macros.h" | |
22 | ||
23 | #undef HOOK_TYPE | |
24 | #define HOOK_TYPE "D Target Hook" | |
25 | ||
26 | HOOK_VECTOR (TARGETDM_INITIALIZER, gcc_targetdm) | |
27 | ||
28 | #undef HOOK_PREFIX | |
29 | #define HOOK_PREFIX "TARGET_" | |
30 | ||
31 | /* Environmental version identifiers relating to the target CPU. */ | |
32 | DEFHOOK | |
33 | (d_cpu_versions, | |
34 | "Declare all environmental version identifiers relating to the target CPU\n\ | |
d92b5067 | 35 | using the function @code{builtin_version}, which takes a string representing\n\ |
b4c522fa IB |
36 | the name of the version. Version identifiers predefined by this hook apply\n\ |
37 | to all modules that are being compiled and imported.", | |
38 | void, (void), | |
39 | hook_void_void) | |
40 | ||
41 | /* Environmental version identifiers relating to the target OS. */ | |
42 | DEFHOOK | |
43 | (d_os_versions, | |
d92b5067 | 44 | "Similarly to @code{TARGET_D_CPU_VERSIONS}, but is used for versions\n\ |
b4c522fa IB |
45 | relating to the target operating system.", |
46 | void, (void), | |
47 | hook_void_void) | |
48 | ||
3785d2b2 IB |
49 | /* getTargetInfo keys relating to the target CPU. */ |
50 | DEFHOOK | |
51 | (d_register_cpu_target_info, | |
52 | "Register all target information keys relating to the target CPU using the\n\ | |
d92b5067 ML |
53 | function @code{d_add_target_info_handlers}, which takes a\n\ |
54 | @samp{struct d_target_info_spec} (defined in @file{d/d-target.h}). The keys\n\ | |
3785d2b2 | 55 | added by this hook are made available at compile time by the\n\ |
d92b5067 | 56 | @code{__traits(getTargetInfo)} extension, the result is an expression\n\ |
3785d2b2 IB |
57 | describing the requested target information.", |
58 | void, (void), | |
59 | hook_void_void) | |
60 | ||
527bc018 IB |
61 | /* getTargetInfo keys relating to the target OS. */ |
62 | DEFHOOK | |
63 | (d_register_os_target_info, | |
d92b5067 | 64 | "Same as @code{TARGET_D_CPU_TARGET_INFO}, but is used for keys relating to\n\ |
527bc018 IB |
65 | the target operating system.", |
66 | void, (void), | |
67 | hook_void_void) | |
68 | ||
4dce3b05 IB |
69 | /* ModuleInfo section name and brackets. */ |
70 | DEFHOOKPOD | |
71 | (d_minfo_section, | |
72 | "Contains the name of the section in which module info references should be\n\ | |
eaa59f08 | 73 | placed. By default, the compiler puts all module info symbols in the\n\ |
d92b5067 | 74 | @code{\"minfo\"} section. Define this macro to override the string if a\n\ |
eaa59f08 | 75 | different section name should be used. This section is expected to be\n\ |
d92b5067 ML |
76 | bracketed by two symbols @code{TARGET_D_MINFO_SECTION_START} and \n\ |
77 | @code{TARGET_D_MINFO_SECTION_END} to indicate the start and end address of\n\ | |
eaa59f08 | 78 | the section, so that the runtime library can collect all modules for each\n\ |
d92b5067 | 79 | loaded shared library and executable. Setting the value to @code{NULL}\n\ |
eaa59f08 IB |
80 | disables the use of sections for storing module info altogether.", |
81 | const char *, "minfo") | |
4dce3b05 IB |
82 | |
83 | DEFHOOKPOD | |
eaa59f08 | 84 | (d_minfo_section_start, |
d92b5067 | 85 | "If @code{TARGET_D_MINFO_SECTION} is defined, then this must also be defined\n\ |
4dce3b05 IB |
86 | as the name of the symbol indicating the start address of the module info\n\ |
87 | section", | |
eaa59f08 | 88 | const char *, "__start_minfo") |
4dce3b05 | 89 | |
4dce3b05 | 90 | DEFHOOKPOD |
eaa59f08 | 91 | (d_minfo_section_end, |
d92b5067 | 92 | "If @code{TARGET_D_MINFO_SECTION} is defined, then this must also be defined\n\ |
4dce3b05 IB |
93 | as the name of the symbol indicating the end address of the module info\n\ |
94 | section", | |
eaa59f08 | 95 | const char *, "__stop_minfo") |
4dce3b05 | 96 | |
d253a6f7 IB |
97 | /* The "stdcall" convention is really supported on 32-bit x86/Windows only. |
98 | The following hook is a helper to determine whether to apply the attribute | |
99 | on declarations with `extern(System)' and `extern(Windows)' linkage. */ | |
100 | DEFHOOK | |
101 | (d_has_stdcall_convention, | |
d92b5067 ML |
102 | "Returns @code{true} if the target supports the stdcall calling convention.\n\ |
103 | The hook should also set @var{link_system} to @code{1} if the @code{stdcall}\n\ | |
104 | attribute should be applied to functions with @code{extern(System)} linkage,\n\ | |
105 | and @var{link_windows} to @code{1} to apply @code{stdcall} to functions with\n\ | |
106 | @code{extern(Windows)} linkage.", | |
d253a6f7 IB |
107 | bool, (unsigned int *link_system, unsigned int *link_windows), |
108 | hook_bool_uintp_uintp_false) | |
109 | ||
bda51959 IB |
110 | /* True if instantiations are always COMDAT if they have external linkage. */ |
111 | DEFHOOKPOD | |
112 | (d_templates_always_comdat, | |
113 | "This flag is true if instantiated functions and variables are always COMDAT\n\ | |
114 | if they have external linkage. If this flag is false, then instantiated\n\ | |
d92b5067 | 115 | decls will be emitted as weak symbols. The default is @code{false}.", |
bda51959 IB |
116 | bool, false) |
117 | ||
b4c522fa IB |
118 | /* Close the 'struct gcc_targetdm' definition. */ |
119 | HOOK_VECTOR_END (C90_EMPTY_HACK) |