152284Sobrien/* Operating system specific defines to be used when targeting GCC for 252284Sobrien hosting on U/WIN (Windows32), using GNU tools and the Windows32 API 352284Sobrien Library, as distinct from winnt.h, which is used to build GCC for use 452284Sobrien with a windows style library and tool set and uses the Microsoft tools. 5169689Skan Copyright (C) 1999, 2002, 2003, 2004 Free Software Foundation, Inc. 652284Sobrien Contributed by Mumit Khan <khan@xraylith.wisc.edu>. 752284Sobrien 8132718SkanThis file is part of GCC. 952284Sobrien 10132718SkanGCC is free software; you can redistribute it and/or modify 1152284Sobrienit under the terms of the GNU General Public License as published by 1252284Sobrienthe Free Software Foundation; either version 2, or (at your option) 1352284Sobrienany later version. 1452284Sobrien 15132718SkanGCC is distributed in the hope that it will be useful, 1652284Sobrienbut WITHOUT ANY WARRANTY; without even the implied warranty of 1752284SobrienMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1852284SobrienGNU General Public License for more details. 1952284Sobrien 2052284SobrienYou should have received a copy of the GNU General Public License 21132718Skanalong with GCC; see the file COPYING. If not, write to 22169689Skanthe Free Software Foundation, 51 Franklin Street, Fifth Floor, 23169689SkanBoston, MA 02110-1301, USA. */ 2452284Sobrien 2552284Sobrien/* Most of this is the same as for Cygwin32, except for changing some 2652284Sobrien specs. */ 2752284Sobrien 2852284Sobrien#define STANDARD_INCLUDE_COMPONENT "UWIN" 2952284Sobrien#define SYSTEM_INCLUDE_DIR "/usr/gnu/include" 3090075Sobrien#undef MD_STARTFILE_PREFIX 3190075Sobrien#define MD_STARTFILE_PREFIX "/usr/gnu/lib/" 3252284Sobrien 33117395Skan#undef MAYBE_UWIN_CPP_BUILTINS 34117395Skan#define MAYBE_UWIN_CPP_BUILTINS() \ 35117395Skan do \ 36117395Skan { \ 37117395Skan builtin_define_std ("WINNT"); \ 38117395Skan builtin_define ("_WIN32"); \ 39117395Skan builtin_define ("__WIN32__"); \ 40117395Skan builtin_define ("_UWIN"); \ 41117395Skan builtin_define ("__UWIN__"); \ 42117395Skan builtin_define ("__MSVCRT__"); \ 43117395Skan builtin_define ("_STD_INCLUDE_DIR=mingw32"); \ 44117395Skan } \ 45117395Skan while (0) 4652284Sobrien 4752284Sobrien#undef CPP_SPEC 48117395Skan#define CPP_SPEC "-remap %{posix:-D_POSIX_SOURCE} \ 4952284Sobrien -include /usr/include/astwin32.h \ 5052284Sobrien -idirafter /usr/gnu/include/mingw32" 5152284Sobrien 5252284Sobrien/* For Windows applications, include more libraries, but always include 5352284Sobrien kernel32. */ 5452284Sobrien#undef LIB_SPEC 5552284Sobrien#define LIB_SPEC \ 5690075Sobrien "%{pg:-lgmon} %{mwindows:-luser32 -lgdi32 -lcomdlg32} -lkernel32 -ladvapi32" 5752284Sobrien 5852284Sobrien/* Include in the mingw32 libraries with libgcc */ 5952284Sobrien#undef LIBGCC_SPEC 6052284Sobrien#define LIBGCC_SPEC "-lgnuwin -lposix -lgcc -last -lmoldname -lmsvcrt" 6152284Sobrien 6252284Sobrien/* Specify a different entry point when linking a DLL */ 6352284Sobrien#undef LINK_SPEC 6452284Sobrien#define LINK_SPEC \ 6590075Sobrien "%{mwindows:--subsystem windows} %{mdll:--dll -e _DllMainCRTStartup@12} \ 6690075Sobrien %{!mdll:-u _main}" 6752284Sobrien 6852284Sobrien#undef STARTFILE_SPEC 6990075Sobrien#define STARTFILE_SPEC "%{mdll:dllcrt2%O%s} %{!mdll:crt2%O%s} %{pg:gcrt2%O%s}" 7052284Sobrien 7190075Sobrien/* These are PE BFD bug workarounds. Should go away eventually. */ 7252284Sobrien 7390075Sobrien/* Write the extra assembler code needed to declare a function 7490075Sobrien properly. If we are generating SDB debugging information, this 7590075Sobrien will happen automatically, so we only need to handle other cases. */ 7652284Sobrien#undef ASM_DECLARE_FUNCTION_NAME 7752284Sobrien#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ 7852284Sobrien do \ 7952284Sobrien { \ 8052284Sobrien if (i386_pe_dllexport_name_p (NAME)) \ 8190075Sobrien i386_pe_record_exported_symbol (NAME, 0); \ 8290075Sobrien /* UWIN binutils bug workaround. */ \ 8352284Sobrien if (0 && write_symbols != SDB_DEBUG) \ 8452284Sobrien i386_pe_declare_function_type (FILE, NAME, TREE_PUBLIC (DECL)); \ 8552284Sobrien ASM_OUTPUT_LABEL (FILE, NAME); \ 8652284Sobrien } \ 8752284Sobrien while (0) 8852284Sobrien 8952284Sobrien#undef ASM_OUTPUT_EXTERNAL 9052284Sobrien#undef ASM_OUTPUT_EXTERNAL_LIBCALL 9152284Sobrien 92