| 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. |
| 4 |
|
| 5 |
This file is part of GCC. |
| 6 |
|
| 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) |
| 10 |
any later version. |
| 11 |
|
| 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. |
| 16 |
|
| 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/>. */ |
| 20 |
|
| 21 |
#ifndef GCC_AARCH64_CYGMING_H |
| 22 |
#define GCC_AARCH64_CYGMING_H |
| 23 |
|
| 24 |
#define DWARF2_DEBUGGING_INFO 1 |
| 25 |
|
| 26 |
#undef PREFERRED_DEBUGGING_TYPE |
| 27 |
#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG |
| 28 |
|
| 29 |
#undef DWARF2_UNWIND_INFO |
| 30 |
#define DWARF2_UNWIND_INFO 0 |
| 31 |
|
| 32 |
#define FASTCALL_PREFIX '@' |
| 33 |
|
| 34 |
#define print_reg(rtx, code, file) (gcc_unreachable ()) |
| 35 |
|
| 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) |
| 39 |
|
| 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) |
| 43 |
|
| 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) |
| 47 |
|
| 48 |
/* Disable SEH and declare the required SEH-related macros that are |
| 49 |
still needed for compilation. */ |
| 50 |
#undef TARGET_SEH |
| 51 |
#define TARGET_SEH 0 |
| 52 |
|
| 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) |
| 56 |
|
| 57 |
#undef TARGET_PECOFF |
| 58 |
#define TARGET_PECOFF 1 |
| 59 |
|
| 60 |
#include <stdbool.h> |
| 61 |
#ifdef __MINGW32__ |
| 62 |
#include <stdio.h> |
| 63 |
#endif |
| 64 |
|
| 65 |
#define TARGET_ASM_NAMED_SECTION mingw_pe_asm_named_section |
| 66 |
|
| 67 |
/* Select attributes for named sections. */ |
| 68 |
#define TARGET_SECTION_TYPE_FLAGS mingw_pe_section_type_flags |
| 69 |
|
| 70 |
#define TARGET_ASM_UNIQUE_SECTION mingw_pe_unique_section |
| 71 |
#define TARGET_ENCODE_SECTION_INFO mingw_pe_encode_section_info |
| 72 |
|
| 73 |
#define TARGET_VALID_DLLIMPORT_ATTRIBUTE_P mingw_pe_valid_dllimport_attribute_p |
| 74 |
|
| 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 |
| 78 |
|
| 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) |
| 82 |
|
| 83 |
/* Use section relative relocations for debugging offsets. Unlike |
| 84 |
other targets that fake this by putting the section VMA at 0, PE |
| 85 |
won't allow it. */ |
| 86 |
#define ASM_OUTPUT_DWARF_OFFSET(FILE, SIZE, LABEL, OFFSET, SECTION) \ |
| 87 |
do { \ |
| 88 |
switch (SIZE) \ |
| 89 |
{ \ |
| 90 |
case 4: \ |
| 91 |
fputs ("\t.secrel32\t", FILE); \ |
| 92 |
assemble_name (FILE, LABEL); \ |
| 93 |
if ((OFFSET) != 0) \ |
| 94 |
fprintf (FILE, "+" HOST_WIDE_INT_PRINT_DEC, \ |
| 95 |
(HOST_WIDE_INT) (OFFSET)); \ |
| 96 |
break; \ |
| 97 |
case 8: \ |
| 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); \ |
| 105 |
if ((OFFSET) != 0) \ |
| 106 |
fprintf (FILE, "+" HOST_WIDE_INT_PRINT_DEC, \ |
| 107 |
(HOST_WIDE_INT) (OFFSET)); \ |
| 108 |
fputs ("\n\t.long\t0", FILE); \ |
| 109 |
break; \ |
| 110 |
default: \ |
| 111 |
gcc_unreachable (); \ |
| 112 |
} \ |
| 113 |
} while (0) |
| 114 |
|
| 115 |
#define TARGET_OS_CPP_BUILTINS() \ |
| 116 |
do \ |
| 117 |
{ \ |
| 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__))"); \ |
| 132 |
} \ |
| 133 |
while (0) |
| 134 |
|
| 135 |
/* Windows64 continues to use a 32-bit long type. */ |
| 136 |
#undef LONG_TYPE_SIZE |
| 137 |
#define LONG_TYPE_SIZE 32 |
| 138 |
|
| 139 |
#undef DEFAULT_SIGNED_CHAR |
| 140 |
#define DEFAULT_SIGNED_CHAR 1 |
| 141 |
|
| 142 |
#undef SIZE_TYPE |
| 143 |
#undef PTRDIFF_TYPE |
| 144 |
#define SIZE_TYPE "long long unsigned int" |
| 145 |
#define PTRDIFF_TYPE "long long int" |
| 146 |
|
| 147 |
#undef WCHAR_TYPE_SIZE |
| 148 |
#undef WCHAR_TYPE |
| 149 |
#define WCHAR_TYPE_SIZE 16 |
| 150 |
#define WCHAR_TYPE "short unsigned int" |
| 151 |
|
| 152 |
#define drectve_section() \ |
| 153 |
(fprintf (asm_out_file, "\t.section\t.drectve\n"), \ |
| 154 |
in_section = NULL) |
| 155 |
|
| 156 |
|
| 157 |
/* Enable alias attribute support. */ |
| 158 |
#ifndef SET_ASM_OP |
| 159 |
#define SET_ASM_OP "\t.set\t" |
| 160 |
#endif |
| 161 |
|
| 162 |
/* GNU as supports weak symbols on PECOFF. */ |
| 163 |
#define ASM_WEAKEN_LABEL(FILE, NAME) \ |
| 164 |
do \ |
| 165 |
{ \ |
| 166 |
fputs ("\t.weak\t", (FILE)); \ |
| 167 |
assemble_name ((FILE), (NAME)); \ |
| 168 |
fputc ('\n', (FILE)); \ |
| 169 |
} \ |
| 170 |
while (0) |
| 171 |
|
| 172 |
/* Get tree.cc to declare a target-specific specialization of |
| 173 |
merge_decl_attributes. */ |
| 174 |
#define TARGET_DLLIMPORT_DECL_ATTRIBUTES 1 |
| 175 |
|
| 176 |
#define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL) \ |
| 177 |
do { \ |
| 178 |
switch (GET_MODE (BODY)) \ |
| 179 |
{ \ |
| 180 |
case E_QImode: \ |
| 181 |
asm_fprintf (STREAM, "\t.byte\t(%LL%d - %LLrtx%d) / 4\n", \ |
| 182 |
VALUE, REL); \ |
| 183 |
break; \ |
| 184 |
case E_HImode: \ |
| 185 |
asm_fprintf (STREAM, "\t.2byte\t(%LL%d - %LLrtx%d) / 4\n", \ |
| 186 |
VALUE, REL); \ |
| 187 |
break; \ |
| 188 |
case E_SImode: \ |
| 189 |
case E_DImode: /* See comment in aarch64_output_casesi. */ \ |
| 190 |
asm_fprintf (STREAM, "\t.word\t(%LL%d - %LLrtx%d) / 4\n", \ |
| 191 |
VALUE, REL); \ |
| 192 |
break; \ |
| 193 |
default: \ |
| 194 |
gcc_unreachable (); \ |
| 195 |
} \ |
| 196 |
} while (0) |
| 197 |
|
| 198 |
#define READONLY_DATA_SECTION_ASM_OP "\t.section\t.rdata,\"dr\"" |
| 199 |
|
| 200 |
#undef SUBTARGET_OVERRIDE_OPTIONS |
| 201 |
#define SUBTARGET_OVERRIDE_OPTIONS \ |
| 202 |
do { \ |
| 203 |
flag_stack_check = STATIC_BUILTIN_STACK_CHECK; \ |
| 204 |
} while (0) |
| 205 |
|
| 206 |
#define SUBTARGET_ATTRIBUTE_TABLE \ |
| 207 |
{ "selectany", 0, 0, true, false, false, false, \ |
| 208 |
mingw_handle_selectany_attribute, NULL } |
| 209 |
|
| 210 |
#undef SUB_TARGET_RECORD_STUB |
| 211 |
#define SUB_TARGET_RECORD_STUB(NAME, DECL) mingw_pe_record_stub((NAME), \ |
| 212 |
DECL_WEAK ((DECL))) |
| 213 |
|
| 214 |
#define SUPPORTS_ONE_ONLY 1 |
| 215 |
|
| 216 |
#undef ASM_DECLARE_OBJECT_NAME |
| 217 |
#define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL) \ |
| 218 |
do { \ |
| 219 |
mingw_pe_declare_type (STREAM, NAME, TREE_PUBLIC (DECL), 0); \ |
| 220 |
ASM_OUTPUT_LABEL ((STREAM), (NAME)); \ |
| 221 |
} while (0) |
| 222 |
|
| 223 |
|
| 224 |
#undef ASM_DECLARE_FUNCTION_NAME |
| 225 |
#define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \ |
| 226 |
do { \ |
| 227 |
mingw_pe_declare_type (STREAM, NAME, TREE_PUBLIC (DECL), 1); \ |
| 228 |
aarch64_declare_function_name (STREAM, NAME, DECL); \ |
| 229 |
} while (0) |
| 230 |
|
| 231 |
|
| 232 |
/* Define this to be nonzero if static stack checking is supported. */ |
| 233 |
#define STACK_CHECK_STATIC_BUILTIN 1 |
| 234 |
|
| 235 |
#define HAVE_GAS_ALIGNED_COMM 1 |
| 236 |
|
| 237 |
#undef MAX_OFILE_ALIGNMENT |
| 238 |
#define MAX_OFILE_ALIGNMENT (8192 * 8) |
| 239 |
|
| 240 |
#undef GOT_ALIAS_SET |
| 241 |
#define GOT_ALIAS_SET mingw_GOT_alias_set () |
| 242 |
|
| 243 |
#define PE_COFF_LEGITIMIZE_EXTERN_DECL(RTX) \ |
| 244 |
(GET_CODE (RTX) == SYMBOL_REF && SYMBOL_REF_WEAK (RTX)) |
| 245 |
|
| 246 |
#define HAVE_64BIT_POINTERS 1 |
| 247 |
|
| 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 |
| 253 |
|
| 254 |
#endif |