home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Source / GNU / gcc / config / i386 / win-nt.h < prev    next >
C/C++ Source or Header  |  1996-03-15  |  5KB  |  163 lines

  1. /* Operating system specific defines to be used when targeting GCC for
  2.    Windows NT 3.x on an i386.
  3.    Copyright (C) 1994, 1995 Free Software Foundation, Inc.
  4.    Contributed by Douglas B. Rupp (drupp@cs.washington.edu).
  5.  
  6. This file is part of GNU CC.
  7.  
  8. GNU CC 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 2, or (at your option)
  11. any later version.
  12.  
  13. GNU CC 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 GNU CC; see the file COPYING.  If not, write to
  20. the Free Software Foundation, 59 Temple Place - Suite 330,
  21. Boston, MA 02111-1307, USA. */
  22.  
  23. #define YES_UNDERSCORES
  24.  
  25. #ifdef NEXT_PDO
  26. #include "i386/gstabs.h"
  27. #else
  28. #include "i386/gas.h"
  29. #endif
  30.  
  31. #ifdef CPP_PREDEFINES
  32. #undef CPP_PREDEFINES
  33. #endif
  34. #define CPP_PREDEFINES "-Dunix -Di386 -DWIN32 -D_WIN32 \
  35.   -DWINNT -D_M_IX86=300 -D_X86_=1 -D__STDC__=0 -DALMOST_STDC -D_MSC_VER=800 \
  36.   -D__stdcall=__attribute__((__stdcall__)) \
  37.   -D__cdecl=__attribute__((__cdecl__)) \
  38.   -D_cdecl=__attribute__((__cdecl__)) \
  39.   -Asystem(unix) -Asystem(winnt) -Acpu(i386) -Amachine(i386)"
  40.  
  41. #ifndef NEXT_PDO
  42. #define SIZE_TYPE "unsigned int"
  43. #define PTRDIFF_TYPE "int"
  44. #endif
  45. #define WCHAR_UNSIGNED 1
  46. #define WCHAR_TYPE_SIZE 16
  47. #define WCHAR_TYPE "short unsigned int"
  48. #ifndef NEXT_PDO
  49. #undef LONG_DOUBLE_TYPE_SIZE
  50. #define LONG_DOUBLE_TYPE_SIZE 64
  51. #define HAVE_ATEXIT 1
  52. #endif
  53.  
  54. #undef EXTRA_SECTIONS
  55. #define EXTRA_SECTIONS in_ctor, in_dtor
  56.  
  57. #undef EXTRA_SECTION_FUNCTIONS
  58. #define EXTRA_SECTION_FUNCTIONS                    \
  59.   CTOR_SECTION_FUNCTION                        \
  60.   DTOR_SECTION_FUNCTION
  61.  
  62. #define CTOR_SECTION_FUNCTION                    \
  63. void                                \
  64. ctor_section ()                            \
  65. {                                \
  66.   if (in_section != in_ctor)                    \
  67.     {                                \
  68.       fprintf (asm_out_file, "\t.section .ctor\n");        \
  69.       in_section = in_ctor;                    \
  70.     }                                \
  71. }
  72.  
  73. #define DTOR_SECTION_FUNCTION                    \
  74. void                                \
  75. dtor_section ()                            \
  76. {                                \
  77.   if (in_section != in_dtor)                    \
  78.     {                                \
  79.       fprintf (asm_out_file, "\t.section .dtor\n");        \
  80.       in_section = in_dtor;                    \
  81.     }                                \
  82. }
  83.  
  84. #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME)    \
  85.   do {                        \
  86.     ctor_section ();                \
  87.     fprintf (FILE, "%s\t", ASM_LONG);        \
  88.     assemble_name (FILE, NAME);            \
  89.     fprintf (FILE, "\n");            \
  90.   } while (0)
  91.  
  92. #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME)           \
  93.   do {                        \
  94.     dtor_section ();                           \
  95.     fprintf (FILE, "%s\t", ASM_LONG);        \
  96.     assemble_name (FILE, NAME);                  \
  97.     fprintf (FILE, "\n");            \
  98.   } while (0)
  99.  
  100. #ifndef NEXT_PDO
  101. /* Define this macro if references to a symbol must be treated
  102.    differently depending on something about the variable or
  103.    function named by the symbol (such as what section it is in).
  104.  
  105.    On i386, if using PIC, mark a SYMBOL_REF for a non-global symbol
  106.    so that we may access it directly in the GOT.
  107.  
  108.    On i386 running Windows NT, modify the assembler name with a suffix 
  109.    consisting of an atsign (@) followed by string of digits that represents
  110.    the number of bytes of arguments passed to the function, if it has the 
  111.    attribute STDCALL. */
  112.  
  113. #ifdef ENCODE_SECTION_INFO
  114. #undef ENCODE_SECTION_INFO
  115. #define ENCODE_SECTION_INFO(DECL)                     \
  116. do                                    \
  117.   {                                    \
  118.     if (flag_pic)                            \
  119.       {                                    \
  120.     rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd'        \
  121.            ? TREE_CST_RTL (DECL) : DECL_RTL (DECL));        \
  122.     SYMBOL_REF_FLAG (XEXP (rtl, 0))                    \
  123.       = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd'            \
  124.          || ! TREE_PUBLIC (DECL));                    \
  125.       }                                    \
  126.     if (TREE_CODE (DECL) == FUNCTION_DECL)                 \
  127.       if (lookup_attribute ("stdcall",                    \
  128.                 TYPE_ATTRIBUTES (TREE_TYPE (DECL))))    \
  129.         XEXP (DECL_RTL (DECL), 0) =                     \
  130.           gen_rtx (SYMBOL_REF, Pmode, gen_stdcall_suffix (DECL));     \
  131.   }                                    \
  132. while (0)
  133. #endif
  134.  
  135. /* The global __fltused is necessary to cause the printf/scanf routines
  136.    for outputting/inputting floating point numbers to be loaded.  Since this
  137.    is kind of hard to detect, we just do it all the time. */
  138.  
  139. #ifdef ASM_FILE_START
  140. #undef ASM_FILE_START
  141. #endif
  142. #define ASM_FILE_START(FILE) \
  143.   do {    fprintf (FILE, "\t.file\t");                \
  144.     output_quoted_string (FILE, dump_base_name);        \
  145.     fprintf (FILE, "\n");                    \
  146.         fprintf (FILE, ".global\t__fltused\n");            \
  147.   } while (0)
  148. #endif /* ! NEXT_PDO */
  149.  
  150. /* if the switch "-mwindows" is passed to ld, then specify to the Microsoft
  151.    linker the proper switches and libraries to build a graphical program */
  152.  
  153. #undef LIB_SPEC
  154. #define LIB_SPEC "%{mwindows:-subsystem windows -e _WinMainCRTStartup \
  155.   USER32.LIB%s GDI32.LIB%s COMDLG32.LIB%s WINSPOOL.LIB%s} \
  156.  %{!mwindows:-subsystem console -e _mainCRTStartup} \
  157.  %{mcrtmt:LIBCMT.LIB%s KERNEL32.LIB%s ADVAPI32.LIB%s} \
  158.  %{!mcrtmt:LIBC.LIB%s KERNEL32.LIB%s ADVAPI32.LIB%s} \
  159.  %{v}"
  160.  
  161. #include "winnt/win-nt.h"
  162.  
  163.