OSDN Git Service

* config/i386/cygwin.h: Search target specfic include directory, if
[pf3gnuchains/gcc-fork.git] / gcc / config / i386 / cygwin.h
index ba51a6f..84b0d15 100644 (file)
@@ -66,26 +66,33 @@ Boston, MA 02111-1307, USA. */
 #define CPP_PREDEFINES "-D_X86_=1 -Asystem=winnt"
 
 #ifdef CROSS_COMPILE
-#define CYGWIN_INCLUDES "-idirafter " CYGWIN_CROSS_DIR "/include"
-#define W32API_INC "-idirafter " CYGWIN_CROSS_DIR "/include/w32api"
+#define CYGWIN_INCLUDES "%{!nostdinc:-idirafter " CYGWIN_CROSS_DIR "/include}"
+#define W32API_INC "%{!nostdinc:-idirafter " CYGWIN_CROSS_DIR "/include/w32api}"
 #define W32API_LIB "-L" CYGWIN_CROSS_DIR "/lib/w32api/"
 #define CYGWIN_LIB CYGWIN_CROSS_DIR "/lib"
 #define MINGW_LIBS "-L" CYGWIN_CROSS_DIR "/lib/mingw"
-#define MINGW_INCLUDES "-isystem " CYGWIN_CROSS_DIR "/include/mingw/g++-3 "\
+#define MINGW_INCLUDES "%{!nostdinc:-isystem " CYGWIN_CROSS_DIR "/include/mingw/g++-3 "\
                       "-isystem " CYGWIN_CROSS_DIR "/include/mingw/g++ "\
-                      "-idirafter " CYGWIN_CROSS_DIR "/include/mingw"
+                      "-idirafter " CYGWIN_CROSS_DIR "/include/mingw}"
 #else
-#define CYGWIN_INCLUDES "-isystem /usr/local/include -idirafter /usr/include"
-#define W32API_INC "-idirafter /usr/include/w32api"
+#define CYGWIN_INCLUDES "%{!nostdinc:-isystem /usr/local/include "\
+                          "-idirafter " CYGWIN_CROSS_DIR "/include "\
+                          "-idirafter /usr/include}"
+#define W32API_INC "%{!nostdinc:-idirafter /usr/include/w32api}"
 #define W32API_LIB "-L/usr/lib/w32api/"
 #define CYGWIN_LIB "/usr/lib"
 #define MINGW_LIBS "-L/usr/local/lib/mingw -L/usr/lib/mingw"
-#define MINGW_INCLUDES "-isystem /usr/include/mingw/g++-3 "\
+#define MINGW_INCLUDES "%{!nostdinc:-isystem /usr/include/mingw/g++-3 "\
                       "-isystem /usr/include/mingw/g++ "\
-                      "-isystem /usr/local/include/mingw" \
-                      "-idirafter /usr/include/mingw"
+                      "-isystem /usr/local/include/mingw "\
+                      "-idirafter " CYGWIN_CROSS_DIR "/include/mingw "\
+                      "-idirafter /usr/include/mingw}"
 #endif
 
+/* Get tree.c to declare a target-specific specialization of
+   merge_decl_attributes.  */
+#define TARGET_DLLIMPORT_DECL_ATTRIBUTES
+
 /* Support the __declspec keyword by turning them into attributes.
    We currently only support: dllimport and dllexport.
    Note that the current way we do this may result in a collision with
@@ -105,16 +112,16 @@ Boston, MA 02111-1307, USA. */
   %{mno-win32:%{mno-cygwin: %emno-cygwin and mno-win32 are not compatible}} \
   %{mno-cygwin:-D__MSVCRT__ -D__MINGW32__ %{mthreads:-D_MT} "\
     MINGW_INCLUDES "} \
-  %{!mno-cygwin:-D__CYGWIN32__ -D__CYGWIN__ -Dunix -D__unix__ -D__unix "\
+  %{!mno-cygwin:-D__CYGWIN32__ -D__CYGWIN__ %{!ansi:-Dunix} -D__unix__ -D__unix "\
     CYGWIN_INCLUDES "}\
-  %{mwin32|mno-cygwin:-DWIN32 -D_WIN32 -D__WIN32 -D__WIN32__ -DWINNT}\
+  %{mwin32|mno-cygwin:-DWIN32 -D_WIN32 -D__WIN32 -D__WIN32__ %{!ansi:-DWINNT}}\
   %{!mno-win32:" W32API_INC "}\
 "
 
 #undef STARTFILE_SPEC
-#define STARTFILE_SPEC W32API_LIB "\
-  %{shared|mdll: %{mno-cygwin:" MINGW_LIBS " mingw/dllcrt2%O%s}}\
-  %{!shared: %{!mdll: %{!mno-cygwin:crt0%O%s} %{mno-cygwin:" MINGW_LIBS " mingw/crt2%O%s}\
+#define STARTFILE_SPEC "\
+  %{shared|mdll: %{mno-cygwin:" MINGW_LIBS " dllcrt2%O%s}}\
+  %{!shared: %{!mdll: %{!mno-cygwin:crt0%O%s} %{mno-cygwin:" MINGW_LIBS " crt2%O%s}\
   %{pg:gcrt0%O%s}}}\
 "
 
@@ -147,13 +154,15 @@ Boston, MA 02111-1307, USA. */
    ld, but that doesn't work just yet.  */
 
 #undef LIB_SPEC
-#define LIB_SPEC "%{pg:-lgmon} \
+#define LIB_SPEC "\
+  %{pg:-lgmon} \
   %{!mno-cygwin:-lcygwin} \
   %{mno-cygwin:%{mthreads:-lmingwthrd} -lmingw32} \
   %{mwindows:-lgdi32 -lcomdlg32} \
   -luser32 -lkernel32 -ladvapi32 -lshell32"
 
-#define LINK_SPEC "%{mwindows:--subsystem windows} \
+#define LINK_SPEC W32API_LIB "\
+  %{mwindows:--subsystem windows} \
   %{mconsole:--subsystem console} \
   %{shared: %{mdll: %eshared and mdll are not compatible}} \
   %{shared: --shared} %{mdll:--dll} \
@@ -176,39 +185,16 @@ Boston, MA 02111-1307, USA. */
 /* Enable parsing of #pragma pack(push,<n>) and #pragma pack(pop).  */
 #define HANDLE_PRAGMA_PACK_PUSH_POP 1
 
-/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS
-   is a valid machine specific attribute for DECL.
-   The attributes in ATTRIBUTES have previously been assigned to DECL.  */
-
 union tree_node;
 #define TREE union tree_node *
 
-#undef VALID_MACHINE_DECL_ATTRIBUTE
-#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \
-  i386_pe_valid_decl_attribute_p (DECL, ATTRIBUTES, IDENTIFIER, ARGS)
-extern int i386_pe_valid_decl_attribute_p PARAMS ((TREE, TREE, TREE, TREE));
-
-/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS
-   is a valid machine specific attribute for TYPE.
-   The attributes in ATTRIBUTES have previously been assigned to TYPE.  */
-
-#undef VALID_MACHINE_TYPE_ATTRIBUTE
-#define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, IDENTIFIER, ARGS) \
-  i386_pe_valid_type_attribute_p (TYPE, ATTRIBUTES, IDENTIFIER, ARGS)
-extern int i386_pe_valid_type_attribute_p PARAMS ((TREE, TREE, TREE, TREE));
-
-extern union tree_node *i386_pe_merge_decl_attributes PARAMS ((TREE, TREE));
-#define MERGE_MACHINE_DECL_ATTRIBUTES(OLD, NEW) \
-  i386_pe_merge_decl_attributes ((OLD), (NEW))
-extern TREE i386_pe_merge_decl_attributes PARAMS ((TREE, TREE));
-
 /* Used to implement dllexport overriding dllimport semantics.  It's also used
    to handle vtables - the first pass won't do anything because
    DECL_CONTEXT (DECL) will be 0 so i386_pe_dll{ex,im}port_p will return 0.
    It's also used to handle dllimport override semantics.  */
 #if 0
 #define REDO_SECTION_INFO_P(DECL) \
-  ((DECL_MACHINE_ATTRIBUTES (DECL) != NULL_TREE) \
+  ((DECL_ATTRIBUTES (DECL) != NULL_TREE) \
    || (TREE_CODE (DECL) == VAR_DECL && DECL_VIRTUAL_P (DECL)))
 #else
 #define REDO_SECTION_INFO_P(DECL) 1
@@ -216,39 +202,13 @@ extern TREE i386_pe_merge_decl_attributes PARAMS ((TREE, TREE));
 
 \f
 #undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_ctor, in_dtor, in_drectve
+#define EXTRA_SECTIONS in_drectve
 
 #undef EXTRA_SECTION_FUNCTIONS
 #define EXTRA_SECTION_FUNCTIONS                                        \
-  CTOR_SECTION_FUNCTION                                                \
-  DTOR_SECTION_FUNCTION                                                \
   DRECTVE_SECTION_FUNCTION                                     \
   SWITCH_TO_SECTION_FUNCTION
 
-#define CTOR_SECTION_FUNCTION                                  \
-void                                                           \
-ctor_section ()                                                        \
-{                                                              \
-  if (in_section != in_ctor)                                   \
-    {                                                          \
-      fprintf (asm_out_file, "\t.section .ctor\n");            \
-      in_section = in_ctor;                                    \
-    }                                                          \
-}
-void ctor_section PARAMS ((void));
-
-#define DTOR_SECTION_FUNCTION                                  \
-void                                                           \
-dtor_section ()                                                        \
-{                                                              \
-  if (in_section != in_dtor)                                   \
-    {                                                          \
-      fprintf (asm_out_file, "\t.section .dtor\n");            \
-      in_section = in_dtor;                                    \
-    }                                                          \
-}
-void dtor_section PARAMS ((void));
-
 #define DRECTVE_SECTION_FUNCTION \
 void                                                                   \
 drectve_section ()                                                     \
@@ -279,29 +239,11 @@ switch_to_section (section, decl)                                 \
       case in_text: text_section (); break;                    \
       case in_data: data_section (); break;                    \
       case in_named: named_section (decl, NULL, 0); break;     \
-      case in_ctor: ctor_section (); break;                    \
-      case in_dtor: dtor_section (); break;                    \
       case in_drectve: drectve_section (); break;              \
       default: abort (); break;                                \
     }                                                          \
 }
 
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME)      \
-  do {                                         \
-    ctor_section ();                           \
-    fprintf (FILE, "%s\t", ASM_LONG);          \
-    assemble_name (FILE, NAME);                        \
-    fprintf (FILE, "\n");                      \
-  } while (0)
-
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME)               \
-  do {                                         \
-    dtor_section ();                                   \
-    fprintf (FILE, "%s\t", ASM_LONG);          \
-    assemble_name (FILE, NAME);                        \
-    fprintf (FILE, "\n");                      \
-  } while (0)
-
 /* Don't allow flag_pic to propagate since gas may produce invalid code
    otherwise. */
 
@@ -424,69 +366,16 @@ do {                                                      \
    symbols must be explicitly imported from shared libraries (DLLs).  */
 #define MULTIPLE_SYMBOL_SPACES
 
-#define UNIQUE_SECTION_P(DECL) DECL_ONE_ONLY (DECL)
 extern void i386_pe_unique_section PARAMS ((TREE, int));
 #define UNIQUE_SECTION(DECL,RELOC) i386_pe_unique_section (DECL, RELOC)
 
 #define SUPPORTS_ONE_ONLY 1
 
-/* A C statement to output something to the assembler file to switch to section
-   NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
-   NULL_TREE.  Some target formats do not support arbitrary sections.  Do not
-   define this macro in such cases.  */
-#undef ASM_OUTPUT_SECTION_NAME
-#define ASM_OUTPUT_SECTION_NAME(STREAM, DECL, NAME, RELOC)             \
-do {                                                                   \
-  static struct section_info                                           \
-    {                                                                  \
-      struct section_info *next;                                       \
-      char *name;                                                      \
-      enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type;               \
-    } *sections;                                                       \
-  struct section_info *s;                                              \
-  const char *mode;                                                    \
-  enum sect_enum type;                                                 \
-                                                                       \
-  for (s = sections; s; s = s->next)                                   \
-    if (!strcmp (NAME, s->name))                                       \
-      break;                                                           \
-                                                                       \
-  if (DECL && TREE_CODE (DECL) == FUNCTION_DECL)                       \
-    type = SECT_EXEC, mode = "x";                                      \
-  else if (DECL && DECL_READONLY_SECTION (DECL, RELOC))                        \
-    type = SECT_RO, mode = "";                                         \
-  else                                                                 \
-    {                                                                  \
-      type = SECT_RW;                                                  \
-      if (DECL && TREE_CODE (DECL) == VAR_DECL                         \
-         && lookup_attribute ("shared", DECL_MACHINE_ATTRIBUTES (DECL))) \
-       mode = "ws";                                                    \
-      else                                                             \
-       mode = "w";                                                     \
-    }                                                                  \
-                                                                       \
-  if (s == 0)                                                          \
-    {                                                                  \
-      s = (struct section_info *) xmalloc (sizeof (struct section_info)); \
-      s->name = xmalloc ((strlen (NAME) + 1) * sizeof (*NAME));                \
-      strcpy (s->name, NAME);                                          \
-      s->type = type;                                                  \
-      s->next = sections;                                              \
-      sections = s;                                                    \
-      fprintf (STREAM, ".section\t%s,\"%s\"\n", NAME, mode);           \
-      /* Functions may have been compiled at various levels of         \
-        optimization so we can't use `same_size' here.  Instead,       \
-        have the linker pick one.  */                                  \
-      if ((DECL) && DECL_ONE_ONLY (DECL))                              \
-       fprintf (STREAM, "\t.linkonce %s\n",                            \
-                TREE_CODE (DECL) == FUNCTION_DECL                      \
-                ? "discard" : "same_size");                            \
-    }                                                                  \
-  else                                                                 \
-    {                                                                  \
-      fprintf (STREAM, ".section\t%s,\"%s\"\n", NAME, mode);           \
-    }                                                                  \
-} while (0)
+/* Switch into a generic section.  */
+#define TARGET_ASM_NAMED_SECTION  i386_pe_asm_named_section
+
+/* Select attributes for named sections.  */
+#define TARGET_SECTION_TYPE_FLAGS  i386_pe_section_type_flags
 
 /* Write the extra assembler code needed to declare a function
    properly.  If we are generating SDB debugging information, this
@@ -560,6 +449,10 @@ extern int i386_pe_dllimport_name_p PARAMS ((const char *));
 #undef BIGGEST_ALIGNMENT
 #define BIGGEST_ALIGNMENT 128
 
+/* Native complier aligns internal doubles in structures on dword boundaries.  */
+#undef BIGGEST_FIELD_ALIGNMENT
+#define BIGGEST_FIELD_ALIGNMENT 64
+
 /* A bitfield declared as `int' forces `int' alignment for the struct.  */
 #undef PCC_BITFIELDS_TYPE_MATTERS
 #define PCC_BITFIELDS_TYPE_MATTERS 1
@@ -571,10 +464,9 @@ extern int i386_pe_dllimport_name_p PARAMS ((const char *));
 #define SET_ASM_OP "\t.set\t"
 #endif
 
-#ifndef INT_ASM_OP
-#define INT_ASM_OP "\t.long\t"
-#endif
-
+/* Override GCC's relative pathname lookup (ie., relocatability) unless
+   otherwise told by other subtargets.  */
+#ifndef WIN32_NO_ABSOLUTE_INST_DIRS
 #undef MD_STARTFILE_PREFIX
 #define MD_STARTFILE_PREFIX     "/usr/lib/"
 
@@ -587,7 +479,8 @@ extern int i386_pe_dllimport_name_p PARAMS ((const char *));
 #undef SYSTEM_INCLUDE_DIR
 #undef STANDARD_INCLUDE_DIR
 #define STANDARD_INCLUDE_DIR 0
-#endif
+#endif /* not CROSS_COMPILE */
+#endif /* not WIN32_NO_ABSOLUTE_INST_DIRS */
 
 #undef TREE