1 /* Operating system specific defines to be used when targeting GCC for
2 hosting on Windows32, using a Unix style C library and tools.
3 Copyright (C) 1995-2025 Free Software Foundation, Inc.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
21 #ifndef GCC_AARCH64_CYGMING_H
22 #define GCC_AARCH64_CYGMING_H
24 #define DWARF2_DEBUGGING_INFO 1
26 #undef PREFERRED_DEBUGGING_TYPE
27 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
29 #undef DWARF2_UNWIND_INFO
30 #define DWARF2_UNWIND_INFO 0
32 #define FASTCALL_PREFIX '@'
34 #define print_reg(rtx, code, file) (gcc_unreachable ())
36 #define SYMBOL_FLAG_DLLIMPORT (SYMBOL_FLAG_MACH_DEP << 0)
37 #define SYMBOL_REF_DLLIMPORT_P(X) \
38 ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_DLLIMPORT) != 0)
40 #define SYMBOL_FLAG_DLLEXPORT (SYMBOL_FLAG_MACH_DEP << 1)
41 #define SYMBOL_REF_DLLEXPORT_P(X) \
42 ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_DLLEXPORT) != 0)
44 #define SYMBOL_FLAG_STUBVAR (SYMBOL_FLAG_MACH_DEP << 2)
45 #define SYMBOL_REF_STUBVAR_P(X) \
46 ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_STUBVAR) != 0)
48 /* Disable SEH and declare the required SEH-related macros that are
49 still needed for compilation. */
53 #define SSE_REGNO_P(N) (gcc_unreachable (), 0)
54 #define GENERAL_REGNO_P(N) (gcc_unreachable (), 0)
55 #define SEH_MAX_FRAME_SIZE (gcc_unreachable (), 0)
58 #define TARGET_PECOFF 1
65 #define TARGET_ASM_NAMED_SECTION mingw_pe_asm_named_section
67 /* Select attributes for named sections. */
68 #define TARGET_SECTION_TYPE_FLAGS mingw_pe_section_type_flags
70 #define TARGET_ASM_UNIQUE_SECTION mingw_pe_unique_section
71 #define TARGET_ENCODE_SECTION_INFO mingw_pe_encode_section_info
73 #define TARGET_VALID_DLLIMPORT_ATTRIBUTE_P mingw_pe_valid_dllimport_attribute_p
75 /* Output function declarations at the end of the file. */
76 #undef TARGET_ASM_FILE_END
77 #define TARGET_ASM_FILE_END mingw_pe_file_end
79 /* Declare the type properly for any external libcall. */
80 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
81 mingw_pe_declare_type (FILE, XSTR (FUN, 0), 1, 1)
83 /* Use section relative relocations for debugging offsets. Unlike
84 other targets that fake this by putting the section VMA at 0, PE
86 #define ASM_OUTPUT_DWARF_OFFSET(FILE, SIZE, LABEL, OFFSET, SECTION) \
91 fputs ("\t.secrel32\t", FILE); \
92 assemble_name (FILE, LABEL); \
94 fprintf (FILE, "+" HOST_WIDE_INT_PRINT_DEC, \
95 (HOST_WIDE_INT) (OFFSET)); \
98 /* This is a hack. There is no 64-bit section relative \
99 relocation. However, the COFF format also does not \
100 support 64-bit file offsets; 64-bit applications are \
101 limited to 32-bits of code+data in any one module. \
102 Fake the 64-bit offset by zero-extending it. */ \
103 fputs ("\t.secrel32\t", FILE); \
104 assemble_name (FILE, LABEL); \
106 fprintf (FILE, "+" HOST_WIDE_INT_PRINT_DEC, \
107 (HOST_WIDE_INT) (OFFSET)); \
108 fputs ("\n\t.long\t0", FILE); \
111 gcc_unreachable (); \
115 #define TARGET_OS_CPP_BUILTINS() \
118 builtin_define ("__MSVCRT__"); \
119 builtin_define ("__MINGW32__"); \
120 builtin_define ("_WIN32"); \
121 builtin_define_std ("WIN32"); \
122 builtin_define_std ("WINNT"); \
123 builtin_define_with_int_value ("_INTEGRAL_MAX_BITS", \
124 TYPE_PRECISION (intmax_type_node)); \
125 builtin_define ("__MINGW64__"); \
126 builtin_define_std ("WIN64"); \
127 builtin_define ("_WIN64"); \
128 builtin_define ("__stdcall=__attribute__((__stdcall__))"); \
129 builtin_define ("__fastcall=__attribute__((__fastcall__))"); \
130 builtin_define ("__thiscall=__attribute__((__thiscall__))"); \
131 builtin_define ("__cdecl=__attribute__((__cdecl__))"); \
135 /* Windows64 continues to use a 32-bit long type. */
136 #undef LONG_TYPE_SIZE
137 #define LONG_TYPE_SIZE 32
139 #undef DEFAULT_SIGNED_CHAR
140 #define DEFAULT_SIGNED_CHAR 1
144 #define SIZE_TYPE "long long unsigned int"
145 #define PTRDIFF_TYPE "long long int"
147 #undef WCHAR_TYPE_SIZE
149 #define WCHAR_TYPE_SIZE 16
150 #define WCHAR_TYPE "short unsigned int"
152 #define drectve_section() \
153 (fprintf (asm_out_file, "\t.section\t.drectve\n"), \
157 /* Enable alias attribute support. */
159 #define SET_ASM_OP "\t.set\t"
162 /* GNU as supports weak symbols on PECOFF. */
163 #define ASM_WEAKEN_LABEL(FILE, NAME) \
166 fputs ("\t.weak\t", (FILE)); \
167 assemble_name ((FILE), (NAME)); \
168 fputc ('\n', (FILE)); \
172 /* Get tree.cc to declare a target-specific specialization of
173 merge_decl_attributes. */
174 #define TARGET_DLLIMPORT_DECL_ATTRIBUTES 1
176 #define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL) \
178 switch (GET_MODE (BODY)) \
181 asm_fprintf (STREAM, "\t.byte\t(%LL%d - %LLrtx%d) / 4\n", \
185 asm_fprintf (STREAM, "\t.2byte\t(%LL%d - %LLrtx%d) / 4\n", \
189 case E_DImode: /* See comment in aarch64_output_casesi. */ \
190 asm_fprintf (STREAM, "\t.word\t(%LL%d - %LLrtx%d) / 4\n", \
194 gcc_unreachable (); \
198 #define READONLY_DATA_SECTION_ASM_OP "\t.section\t.rdata,\"dr\""
200 #undef SUBTARGET_OVERRIDE_OPTIONS
201 #define SUBTARGET_OVERRIDE_OPTIONS \
203 flag_stack_check = STATIC_BUILTIN_STACK_CHECK; \
206 #define SUBTARGET_ATTRIBUTE_TABLE \
207 { "selectany", 0, 0, true, false, false, false, \
208 mingw_handle_selectany_attribute, NULL }
210 #undef SUB_TARGET_RECORD_STUB
211 #define SUB_TARGET_RECORD_STUB(NAME, DECL) mingw_pe_record_stub((NAME), \
214 #define SUPPORTS_ONE_ONLY 1
216 #undef ASM_DECLARE_OBJECT_NAME
217 #define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL) \
219 mingw_pe_declare_type (STREAM, NAME, TREE_PUBLIC (DECL), 0); \
220 ASM_OUTPUT_LABEL ((STREAM), (NAME)); \
224 #undef ASM_DECLARE_FUNCTION_NAME
225 #define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \
227 mingw_pe_declare_type (STREAM, NAME, TREE_PUBLIC (DECL), 1); \
228 aarch64_declare_function_name (STREAM, NAME, DECL); \
232 /* Define this to be nonzero if static stack checking is supported. */
233 #define STACK_CHECK_STATIC_BUILTIN 1
235 #define HAVE_GAS_ALIGNED_COMM 1
237 #undef MAX_OFILE_ALIGNMENT
238 #define MAX_OFILE_ALIGNMENT (8192 * 8)
241 #define GOT_ALIAS_SET mingw_GOT_alias_set ()
243 #define PE_COFF_LEGITIMIZE_EXTERN_DECL(RTX) \
244 (GET_CODE (RTX) == SYMBOL_REF && SYMBOL_REF_WEAK (RTX))
246 #define HAVE_64BIT_POINTERS 1
248 /* Kludge because of missing PE-COFF support for early LTO debug. */
249 #undef TARGET_ASM_LTO_START
250 #define TARGET_ASM_LTO_START mingw_pe_asm_lto_start
251 #undef TARGET_ASM_LTO_END
252 #define TARGET_ASM_LTO_END mingw_pe_asm_lto_end