1  /* Operating system specific defines to be used when targeting GCC for
       2     hosting on Windows 32/64 via Cygwin runtime, using GNU tools and
       3     the Windows API Library.
       4     Copyright (C) 2013-2023 Free Software Foundation, Inc.
       5  
       6  This file is part of GCC.
       7  
       8  GCC is free software; you can redistribute it and/or modify
       9  it under the terms of the GNU General Public License as published by
      10  the Free Software Foundation; either version 3, or (at your option)
      11  any later version.
      12  
      13  GCC is distributed in the hope that it will be useful,
      14  but WITHOUT ANY WARRANTY; without even the implied warranty of
      15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      16  GNU General Public License for more details.
      17  
      18  You should have received a copy of the GNU General Public License
      19  along with GCC; see the file COPYING3.  If not see
      20  <http://www.gnu.org/licenses/>.  */
      21  
      22  /* Enable multilib.  */
      23  
      24  #undef ASM_SPEC
      25  #define ASM_SPEC "%{m32:--32} %{m64:--64}"
      26  
      27  /* To implement C++ function replacement we always wrap the cxx
      28     malloc-like operators.  See N2800 #17.6.4.6 [replacement.functions] */
      29  #undef CXX_WRAP_SPEC_LIST
      30  #define CXX_WRAP_SPEC_LIST " \
      31    --wrap _Znwm \
      32    --wrap _Znam \
      33    --wrap _ZdlPv \
      34    --wrap _ZdaPv \
      35    --wrap _ZnwmRKSt9nothrow_t \
      36    --wrap _ZnamRKSt9nothrow_t \
      37    --wrap _ZdlPvRKSt9nothrow_t \
      38    --wrap _ZdaPvRKSt9nothrow_t \
      39  "
      40  
      41  #undef SPEC_32
      42  #undef SPEC_64
      43  #define SPEC_32 "m32"
      44  #define SPEC_64 "!m32"
      45  
      46  #undef SUB_LINK_ENTRY32
      47  #undef SUB_LINK_ENTRY64
      48  #define SUB_LINK_ENTRY32 "-e __cygwin_dll_entry@12"
      49  #define SUB_LINK_ENTRY64 "-e _cygwin_dll_entry"
      50  
      51  #undef SUB_LINK_SPEC
      52  #undef SUB_LINK_ENTRY
      53  #define SUB_LINK_SPEC "%{" SPEC_64 ":-m i386pep} %{" SPEC_32 ":-m i386pe}"
      54  #define SUB_LINK_ENTRY "%{" SPEC_64 ":" SUB_LINK_ENTRY64 "} %{" SPEC_32 ":" SUB_LINK_ENTRY32 "}"
      55  
      56  #undef MULTILIB_DEFAULTS
      57  #define MULTILIB_DEFAULTS { "m64" }
      58  
      59  #undef LINK_SPEC
      60  #define LINK_SPEC SUB_LINK_SPEC "\
      61    %{mwindows:--subsystem windows} \
      62    %{mconsole:--subsystem console} \
      63    " CXX_WRAP_SPEC " \
      64    %{shared: %{mdll: %eshared and mdll are not compatible}} \
      65    %{shared: --shared} %{mdll:--dll} \
      66    %{static:-Bstatic} %{!static:-Bdynamic} \
      67    %{shared|mdll: " SUB_LINK_ENTRY " --enable-auto-image-base} \
      68    %(shared_libgcc_undefs) \
      69    --dll-search-prefix=cyg \
      70    %{!shared: %{!mdll: %{" SPEC_32 ":--large-address-aware} --tsaware}}"
      71  
      72  /* Cygwin64 will have a 64-bit long type. */
      73  #undef LONG_TYPE_SIZE
      74  #undef LONG_TYPE_SIZE
      75  #define LONG_TYPE_SIZE (TARGET_64BIT ? 64 : 32)
      76  
      77  /* Override default "long long unsigned int" from cygming.h. */
      78  #undef SIZE_TYPE
      79  #define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int")
      80  #undef PTRDIFF_TYPE
      81  #define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int")
      82  
      83  #undef LIBGCC_SONAME
      84  #define LIBGCC_SONAME "cyggcc_s-seh-1.dll"