uwin.h revision 90075
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.
552284Sobrien   Copyright (C) 1999 Free Software Foundation, Inc.
652284Sobrien   Contributed by Mumit Khan  <khan@xraylith.wisc.edu>.
752284Sobrien
852284SobrienThis file is part of GNU CC.
952284Sobrien
1052284SobrienGNU CC 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
1552284SobrienGNU CC 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
2152284Sobrienalong with GNU CC; see the file COPYING.  If not, write to
2252284Sobrienthe Free Software Foundation, 59 Temple Place - Suite 330,
2390075SobrienBoston, MA 02111-1307, USA.  */
2452284Sobrien
2552284Sobrien/* Most of this is the same as for Cygwin32, except for changing some
2652284Sobrien   specs.  */
2752284Sobrien
2852284Sobrien#include "i386/cygwin.h"
2952284Sobrien
3052284Sobrien#define STANDARD_INCLUDE_COMPONENT "UWIN"
3152284Sobrien#define SYSTEM_INCLUDE_DIR "/usr/gnu/include"
3290075Sobrien#undef MD_STARTFILE_PREFIX
3390075Sobrien#define MD_STARTFILE_PREFIX "/usr/gnu/lib/"
3452284Sobrien
3552284Sobrien#undef CPP_PREDEFINES
3690075Sobrien#define CPP_PREDEFINES "-D_WIN32 -D__WIN32__ \
3752284Sobrien  -D_UWIN -DWINNT  -D_X86_=1 -D__STDC__=1 \
3852284Sobrien  -D__UWIN__ -D__MSVCRT__ \
3952284Sobrien  -D_STD_INCLUDE_DIR=mingw32 \
4052284Sobrien  -D__stdcall=__attribute__((__stdcall__)) \
4152284Sobrien  _D_stdcall=__attribute__((__stdcall__)) \
4252284Sobrien  -D__cdecl=__attribute__((__cdecl__)) \
4352284Sobrien  -D__declspec(x)=__attribute__((x)) \
4490075Sobrien  -Asystem=winnt"
4552284Sobrien
4652284Sobrien#undef CPP_SPEC
4752284Sobrien#define CPP_SPEC "-remap %(cpp_cpu) %{posix:-D_POSIX_SOURCE} \
4852284Sobrien  -include /usr/include/astwin32.h \
4952284Sobrien  -idirafter /usr/gnu/include/mingw32"
5052284Sobrien
5152284Sobrien/* For Windows applications, include more libraries, but always include
5252284Sobrien   kernel32.  */
5352284Sobrien#undef LIB_SPEC
5452284Sobrien#define LIB_SPEC \
5590075Sobrien  "%{pg:-lgmon} %{mwindows:-luser32 -lgdi32 -lcomdlg32} -lkernel32 -ladvapi32"
5652284Sobrien
5790075Sobrien/* This is needed in g77spec.c for now. Will be removed in the future.  */
5852284Sobrien#define WIN32_UWIN_TARGET 1
5952284Sobrien
6052284Sobrien/* Include in the mingw32 libraries with libgcc */
6152284Sobrien#undef LIBGCC_SPEC
6252284Sobrien#define LIBGCC_SPEC "-lgnuwin -lposix -lgcc -last -lmoldname -lmsvcrt"
6352284Sobrien
6452284Sobrien/* Specify a different entry point when linking a DLL */
6552284Sobrien#undef LINK_SPEC
6652284Sobrien#define LINK_SPEC \
6790075Sobrien  "%{mwindows:--subsystem windows} %{mdll:--dll -e _DllMainCRTStartup@12} \
6890075Sobrien  %{!mdll:-u _main}"
6952284Sobrien
7052284Sobrien#undef STARTFILE_SPEC
7190075Sobrien#define STARTFILE_SPEC "%{mdll:dllcrt2%O%s} %{!mdll:crt2%O%s} %{pg:gcrt2%O%s}"
7252284Sobrien
7390075Sobrien/* These are PE BFD bug workarounds. Should go away eventually.  */
7452284Sobrien
7590075Sobrien/* Write the extra assembler code needed to declare a function
7690075Sobrien   properly.  If we are generating SDB debugging information, this
7790075Sobrien   will happen automatically, so we only need to handle other cases.  */
7852284Sobrien#undef ASM_DECLARE_FUNCTION_NAME
7952284Sobrien#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)			\
8052284Sobrien  do									\
8152284Sobrien    {									\
8252284Sobrien      if (i386_pe_dllexport_name_p (NAME))				\
8390075Sobrien	i386_pe_record_exported_symbol (NAME, 0);			\
8490075Sobrien      /* UWIN binutils bug workaround.  */				\
8552284Sobrien      if (0 && write_symbols != SDB_DEBUG)				\
8652284Sobrien	i386_pe_declare_function_type (FILE, NAME, TREE_PUBLIC (DECL));	\
8752284Sobrien      ASM_OUTPUT_LABEL (FILE, NAME);					\
8852284Sobrien    }									\
8952284Sobrien  while (0)
9052284Sobrien
9152284Sobrien#undef ASM_OUTPUT_EXTERNAL
9252284Sobrien#undef ASM_OUTPUT_EXTERNAL_LIBCALL
9352284Sobrien
9490075Sobrien/* Override Cygwin's definition. This is necessary now due to the way
9590075Sobrien   Cygwin profiling code is written. Once "fixed", we can remove this.  */
9690075Sobrien#undef SUBTARGET_PROLOGUE
9790075Sobrien
98