home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Source / GNU / gcc / config / i386 / next-pdo.h < prev    next >
C/C++ Source or Header  |  1997-02-11  |  13KB  |  348 lines

  1. /* Operating system specific defines to be used when targeting GCC for
  2.    OPENSTEP for Windows NT 3.x on an i386.
  3.    Copyright (C) 1995-1996 NeXT Software, Inc.
  4.  
  5. This file is part of GNU CC.
  6.  
  7. GNU CC 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 2, or (at your option)
  10. any later version.
  11.  
  12. GNU CC 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 GNU CC; see the file COPYING.  If not, write to
  19. the Free Software Foundation, 59 Temple Place - Suite 330,
  20. Boston, MA 02111-1307, USA. */
  21.  
  22. #ifndef NEXT_OBJC_RUNTIME
  23. #define NEXT_OBJC_RUNTIME
  24. #endif
  25. #ifndef NEXT_PDO
  26. #define NEXT_PDO
  27. #endif
  28.  
  29. #define NEXT_CPP_PRECOMP
  30.  
  31. #include "i386/win-nt.h"
  32.  
  33. #undef SIZE_TYPE
  34. #define SIZE_TYPE "unsigned int"
  35.  
  36. #undef CPP_PREDEFINES
  37. #define CPP_PREDEFINES "-Di386 -DWIN32 -D_WIN32 -Dwinnt -DWINNT \
  38.   -D_M_IX86=300 -D_X86_=1 -D__STDC__=0 -DALMOST_STDC \
  39.   -DNeXT_PDO -D_MT -D_DLL -D__LITTLE_ENDIAN__ -D__ARCHITECTURE__=\\\"i386\\\" \
  40.   -Asystem(winnt) -Acpu(i386) -Amachine(i386)"
  41.  
  42. #undef CPP_SPEC
  43. #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{F*} %{static:}"
  44.  
  45. #define ASM_FINAL_SPEC \
  46.   "%{gcodeview*:\nStabsToCodeview %{c:%{o*:%*}%{!o*:%b.o}}%{!c:%U.o} %{g*}} \
  47.    %{scatter:\nScatterPrep %{c:%{o*:%*}%{!o*:%b.o}}%{!c:%U.o}}"
  48.  
  49. #undef LIB_SPEC
  50. #define LIB_SPEC \
  51.   "%{dll:dllmain.o nsregisterdll.o} %{bundle:dllmain.o nsregisterdll.o} \
  52.    %{dynamiclib:dllmain.o nsregisterdll.o} \
  53.    nextpdo.lib msvcrt.lib kernel32.lib %{wing:wing32.lib} \
  54.    wsock32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib \
  55.    shell32.lib ole32.lib oleaut32.lib uuid.lib %{!shared:-lgcc}"
  56.  
  57. #define LIBGCC_SPEC ""
  58.  
  59. #undef LINK_SPEC
  60. #define LINK_SPEC "%{F*} %{framework*} -nodefaultlib -align:0x1000 \
  61.   %{gcodeview:%{!gcodeview0:-debug -debugtype:both -pdb:none}} %{undefined*} \
  62.   %{image_base*} %{!v:-nologo} \
  63.   %{dll} %{!dll:%{bundle:-dll} \
  64.         %{!bundle:%{!win:-subsystem:console -entry:mainCRTStartup} \
  65.               %{win:-subsystem:windows -entry:WinMainCRTStartup}}}"
  66.  
  67. #undef TARGET_VERSION
  68. #define TARGET_VERSION  fprintf( stderr, " (i386-nextpdo-winnt3.51)" );
  69.  
  70. #undef STANDARD_EXEC_PREFIX
  71. #define STANDARD_EXEC_PREFIX "/NextDeveloper/Libraries/gcc-lib/"
  72.  
  73. #undef STANDARD_STARTFILE_PREFIX
  74. #define STANDARD_STARTFILE_PREFIX "/NextDeveloper/Libraries/"
  75.  
  76. #undef TOOLDIR_BASE_PREFIX
  77. #define TOOLDIR_BASE_PREFIX "/NextDeveloper/"
  78.  
  79. #undef GPLUSPLUS_INCLUDE_DIR
  80. #define GPLUSPLUS_INCLUDE_DIR "/NextDeveloper/include/g++/"
  81.  
  82. #undef GCC_INCLUDE_DIR
  83. #define GCC_INCLUDE_DIR "/usr/local/gcc/"
  84.  
  85. #undef LOCAL_INCLUDE_DIR
  86. #define LOCAL_INCLUDE_DIR "/usr/local/include/"
  87.  
  88. #undef INCLUDE_DEFAULTS
  89. #define INCLUDE_DEFAULTS                        \
  90.   {                                    \
  91.     { GPLUSPLUS_INCLUDE_DIR, 1, 1 },                    \
  92.     { GCC_INCLUDE_DIR, 0 },                        \
  93.     { LOCAL_INCLUDE_DIR, 0 },                        \
  94.     { "/NextLibrary/Frameworks/System.framework/Headers", 0 },        \
  95.     { "/NextLibrary/Frameworks/System.framework/Headers/ansi", 0 },    \
  96.     { "/NextLibrary/Frameworks/System.framework/Headers/bsd", 0 },    \
  97.     { "/NextLibrary/Frameworks/System.framework/PrivateHeaders", 0 },    \
  98.     { "/NextLibrary/Frameworks/System.framework/PrivateHeaders/ansi", 0 }, \
  99.     { "/NextLibrary/Frameworks/System.framework/PrivateHeaders/bsd", 0 },  \
  100.     { "/NextDeveloper/Headers", 0 },                    \
  101.     { "/NextDeveloper/Headers/ansi", 0 },                \
  102.     { "/NextDeveloper/Headers/bsd", 0 },                \
  103.     { "/LocalDeveloper/Headers", 0, 1 },                \
  104.     { "/LocalDeveloper/Headers/ansi", 0 },                \
  105.     { "/LocalDeveloper/Headers/bsd", 0 },                \
  106.     { 0, 0, 0 }                                \
  107.   }
  108.  
  109. #define WIFSIGNALED(S) ((S) != SUCCESS_EXIT_CODE && (S) != FATAL_EXIT_CODE)
  110. #define WIFEXITED(S) 1
  111. #define WEXITSTATUS(S) (S)
  112.  
  113. /* Report errors to make application. */
  114.  
  115. #define REPORT_EVENT(TYPE, NAME, FILE, LINE, MSG, ARG1, ARG2, ARG3)    \
  116.   make_support (TYPE, NAME, FILE, LINE, MSG, ARG1, ARG2, ARG3)
  117. #define V_REPORT_EVENT(TYPE, NAME, FILE, LINE, MSG, AP)            \
  118.   v_make_support (TYPE, NAME, FILE, LINE, MSG, AP)
  119.  
  120. /* For profiling, use the MS "_penter" name, and make sure it gets called
  121.  * before the prologue.
  122.  */
  123. #define PROFILE_BEFORE_PROLOGUE
  124. #undef    FUNCTION_PROFILER
  125. #define FUNCTION_PROFILER(FILE, LABELNO)                \
  126. {                                    \
  127.     fprintf(FILE,"\tcall __penter\n");                \
  128. }
  129.  
  130. #undef CONST_SECTION_FUNCTION 
  131. #define CONST_SECTION_FUNCTION                    \
  132. void                                \
  133. const_section ()                        \
  134. {                                \
  135.   if (in_section != in_const)                    \
  136.     {                                \
  137.       fprintf (asm_out_file, "\t.const\n");            \
  138.       in_section = in_const;                    \
  139.     }                                \
  140. }
  141.  
  142. #undef CTOR_SECTION_FUNCTION
  143. #define CTOR_SECTION_FUNCTION                    \
  144. void                                \
  145. ctor_section ()                            \
  146. {                                \
  147.   if (in_section != in_ctor)                    \
  148.     {                                \
  149.       fprintf (asm_out_file, "\t.section .CRT$XCU\n");        \
  150.       in_section = in_ctor;                    \
  151.     }                                \
  152. }
  153.  
  154. #undef EXTRA_SECTIONS
  155. #define EXTRA_SECTIONS in_ctor, in_dtor, in_const
  156.  
  157. #undef EXTRA_SECTION_FUNCTIONS
  158. #define EXTRA_SECTION_FUNCTIONS                    \
  159.   CONST_SECTION_FUNCTION                    \
  160.   CTOR_SECTION_FUNCTION                        \
  161.   DTOR_SECTION_FUNCTION
  162.  
  163. #undef READONLY_DATA_SECTION 
  164. #define READONLY_DATA_SECTION() const_section()
  165.  
  166. /* SELECT_SECTION implementation for ObjC sections.
  167.  * Copied from original nextstep.h.
  168.  *
  169.  * Currently the ObjC data is broken out into only
  170.  * two different sections, depending upon whether they
  171.  * are ever written on or not.
  172.  *
  173.  * We can modify the objc_blah_section macros later to
  174.  * add specific named sections.
  175.  */
  176.  
  177. #define objc_cls_meth_section        data_section
  178. #define objc_inst_meth_section        data_section
  179. #define objc_cat_cls_meth_section     data_section
  180. #define objc_cat_inst_meth_section     data_section
  181. #define objc_class_vars_section     data_section
  182. #define objc_instance_vars_section     data_section
  183. #define objc_cat_cls_meth_section     data_section
  184. #define objc_cls_refs_section         data_section
  185. #define objc_class_section         data_section
  186. #define objc_meta_class_section     data_section
  187. #define objc_category_section         data_section
  188. #define objc_selector_refs_section     data_section
  189. #define objc_symbols_section         data_section
  190. #define objc_module_info_section     data_section
  191. #define objc_cat_inst_meth_section     data_section
  192. #define objc_cat_cls_meth_section     data_section
  193. #define objc_cat_cls_meth_section     data_section
  194. #define objc_protocol_section         data_section
  195. #define objc_string_object_section    data_section
  196.  
  197. #define objc_class_names_section     readonly_data_section
  198. #define objc_meth_var_names_section     readonly_data_section
  199. #define objc_meth_var_types_section     readonly_data_section
  200.  
  201. #undef    SELECT_SECTION
  202. #define SELECT_SECTION(exp,reloc)                \
  203.   do                                \
  204.     {                                \
  205.       if (TREE_CODE (exp) == STRING_CST)            \
  206.     {                            \
  207.       if (flag_writable_strings)                \
  208.         data_section ();                    \
  209.       else                             \
  210.         readonly_data_section ();                \
  211.     }                            \
  212.       else if ((TREE_CODE (exp) == INTEGER_CST)            \
  213.            || (TREE_CODE (exp) == REAL_CST))        \
  214.         {                            \
  215.         readonly_data_section ();                \
  216.     }                            \
  217.       else if (TREE_CODE (exp) == CONSTRUCTOR                \
  218.            && TREE_TYPE (exp)                    \
  219.            && TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE        \
  220.            && TYPE_NAME (TREE_TYPE (exp))                \
  221.            && TREE_CODE (TYPE_NAME (TREE_TYPE (exp))) == IDENTIFIER_NODE \
  222.            && IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE (exp))))    \
  223.     {                                \
  224.       if (!strcmp (IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE (exp))),\
  225.             "NSConstantString"))                \
  226.         objc_string_object_section ();                \
  227.       else if (!strcmp (IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE (exp))), \
  228.             "NXConstantString"))                \
  229.         objc_string_object_section ();                \
  230.       else if ((TREE_READONLY (exp) || TREE_CONSTANT (exp))        \
  231.            && !TREE_SIDE_EFFECTS (exp))                \
  232.         readonly_data_section ();                    \
  233.     else                                \
  234.       data_section ();                        \
  235.       }                                    \
  236.       else if (TREE_CODE (exp) == VAR_DECL &&                \
  237.            DECL_NAME (exp) &&                    \
  238.            TREE_CODE (DECL_NAME (exp)) == IDENTIFIER_NODE &&    \
  239.            IDENTIFIER_POINTER (DECL_NAME (exp)) &&            \
  240.            !strncmp (IDENTIFIER_POINTER (DECL_NAME (exp)), "_OBJC_", 6)) \
  241.     {                                \
  242.       const char *name = IDENTIFIER_POINTER (DECL_NAME (exp));    \
  243.                                       \
  244.       if (!strncmp (name, "_OBJC_CLASS_METHODS_", 20))        \
  245.         objc_cls_meth_section ();                    \
  246.       else if (!strncmp (name, "_OBJC_INSTANCE_METHODS_", 23))    \
  247.         objc_inst_meth_section ();                    \
  248.       else if (!strncmp (name, "_OBJC_CATEGORY_CLASS_METHODS_", 20)) \
  249.         objc_cat_cls_meth_section ();                \
  250.       else if (!strncmp (name, "_OBJC_CATEGORY_INSTANCE_METHODS_", 23)) \
  251.         objc_cat_inst_meth_section ();                \
  252.       else if (!strncmp (name, "_OBJC_CLASS_VARIABLES_", 22))    \
  253.         objc_class_vars_section ();                    \
  254.       else if (!strncmp (name, "_OBJC_INSTANCE_VARIABLES_", 25))    \
  255.         objc_instance_vars_section ();                \
  256.       else if (!strncmp (name, "_OBJC_CLASS_PROTOCOLS_", 22))    \
  257.         objc_cat_cls_meth_section ();                \
  258.       else if (!strncmp (name, "_OBJC_CLASS_NAME_", 17))        \
  259.         objc_class_names_section ();                \
  260.       else if (!strncmp (name, "_OBJC_METH_VAR_NAME_", 20))        \
  261.         objc_meth_var_names_section ();                \
  262.       else if (!strncmp (name, "_OBJC_METH_VAR_TYPE_", 20))        \
  263.         objc_meth_var_types_section ();                \
  264.       else if (!strncmp (name, "_OBJC_CLASS_REFERENCES", 22))    \
  265.         objc_cls_refs_section ();                    \
  266.       else if (!strncmp (name, "_OBJC_CLASS_", 12))            \
  267.         objc_class_section ();                    \
  268.       else if (!strncmp (name, "_OBJC_METACLASS_", 16))        \
  269.         objc_meta_class_section ();                    \
  270.       else if (!strncmp (name, "_OBJC_CATEGORY_", 15))        \
  271.         objc_category_section ();                    \
  272.       else if (!strncmp (name, "_OBJC_SELECTOR_REFERENCES", 25))    \
  273.         objc_selector_refs_section ();                \
  274.       else if (!strncmp (name, "_OBJC_SYMBOLS", 13))        \
  275.         objc_symbols_section ();                    \
  276.       else if (!strncmp (name, "_OBJC_MODULES", 13))        \
  277.         objc_module_info_section ();                \
  278.       else if (!strncmp (name, "_OBJC_PROTOCOL_INSTANCE_METHODS_", 32)) \
  279.         objc_cat_inst_meth_section ();                              \
  280.       else if (!strncmp (name, "_OBJC_PROTOCOL_CLASS_METHODS_", 29)) \
  281.         objc_cat_cls_meth_section ();                               \
  282.       else if (!strncmp (name, "_OBJC_PROTOCOL_REFS_", 20))         \
  283.         objc_cat_cls_meth_section ();                               \
  284.       else if (!strncmp (name, "_OBJC_PROTOCOL_", 15))              \
  285.         objc_protocol_section ();                                   \
  286.       else if ((TREE_READONLY (exp) || TREE_CONSTANT (exp))        \
  287.         && !TREE_SIDE_EFFECTS (exp))                 \
  288.         readonly_data_section ();                                   \
  289.       else                                \
  290.         data_section ();                        \
  291.     }                                \
  292.       else if (TREE_CODE (exp) == VAR_DECL)                \
  293.     {                                \
  294.       if ((flag_pic && reloc)                    \
  295.           || !TREE_READONLY (exp) || TREE_SIDE_EFFECTS (exp)    \
  296.           || !DECL_INITIAL (exp)                    \
  297.           || (DECL_INITIAL (exp) != error_mark_node            \
  298.           && !TREE_CONSTANT (DECL_INITIAL (exp))))        \
  299.         data_section ();                        \
  300.       else                                \
  301.         readonly_data_section ();                    \
  302.     }                                \
  303.       else if (!strcmp (lang_identify (), "cplusplus"))            \
  304.     /* The default should probably be readonly_data_section (),    \
  305.        regardless of whether the compiler is Objective-C or        \
  306.        Objective-C++, but this can cause data structures for    \
  307.        Objective-C++ constant strings to be put in the data section    \
  308.        (see Tracker    bug 71979).  A better fix for this bug should    \
  309.        be investigated.  */                        \
  310.     data_section ();                        \
  311.       else                                \
  312.     readonly_data_section ();                    \
  313.     }                                    \
  314.   while (0)
  315.  
  316. #undef ASM_OUTPUT_ALIGN
  317. #define ASM_OUTPUT_ALIGN(FILE,LOG) \
  318.     if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG))
  319.  
  320. /* gdb needs a null N_SO at the end of each file for scattered loading. */
  321.  
  322. #undef    DBX_OUTPUT_MAIN_SOURCE_FILE_END
  323. #define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME)            \
  324.   fprintf (FILE,                            \
  325.        "\t.text\n\t.stabs \"\",%d,0,0,Letext\nLetext:\n",        \
  326.        N_SO)
  327.  
  328. /* These are all set here (or unset here!) so that struct
  329.    returns are done in registers if they will fit. See the
  330.    additional comments in config/winnt/winnt.h for other
  331.    issues involved with struct returns. */
  332. #undef PCC_STRUCT_RETURN
  333. #define DEFAULT_PCC_STRUCT_RETURN 0
  334.  
  335. #define WORD_SWITCH_TAKES_ARG(STR)                \
  336.   (DEFAULT_WORD_SWITCH_TAKES_ARG (STR)                \
  337.    || !strcmp (STR, "arch")                    \
  338.    || !strcmp (STR, "filelist")                    \
  339.    || !strcmp (STR, "framework")                \
  340.    || !strcmp (STR, "undefined")                \
  341.    || !strcmp (STR, "image_base"))
  342.  
  343. #define WORD_SWITCH(STR)            \
  344.   (WORD_SWITCH_TAKES_ARG(STR)            \
  345.    || !strcmp (STR, "bundle"))
  346.  
  347. #include <winnt-pdo.h>
  348.