OSDN Git Service

Revert:
[pf3gnuchains/gcc-fork.git] / gcc / config / i386 / cygming.h
index c82e6df..71a5d8d 100644 (file)
@@ -1,14 +1,14 @@
 /* Operating system specific defines to be used when targeting GCC for
    hosting on Windows32, using a Unix style C library and tools.
    Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-   2004, 2005, 2007
+   2004, 2005, 2007, 2008, 2009, 2010
    Free Software Foundation, Inc.
 
 This file is part of GCC.
 
 GCC is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
+the Free Software Foundation; either version 3, or (at your option)
 any later version.
 
 GCC is distributed in the hope that it will be useful,
@@ -17,9 +17,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING.  If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA.  */
+along with GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
 
 #define DBX_DEBUGGING_INFO 1
 #define SDB_DEBUGGING_INFO 1
@@ -35,7 +34,15 @@ Boston, MA 02110-1301, USA.  */
 #endif
 
 #undef TARGET_64BIT_MS_ABI
-#define TARGET_64BIT_MS_ABI TARGET_64BIT
+#define TARGET_64BIT_MS_ABI (!cfun ? ix86_abi == MS_ABI : TARGET_64BIT && cfun->machine->call_abi == MS_ABI)
+
+#undef DEFAULT_ABI
+#define DEFAULT_ABI (TARGET_64BIT ? MS_ABI : SYSV_ABI)
+
+#if ! defined (USE_MINGW64_LEADING_UNDERSCORES)
+#undef USER_LABEL_PREFIX
+#define USER_LABEL_PREFIX (TARGET_64BIT ? "" : "_")
+#endif
 
 #undef DBX_REGISTER_NUMBER
 #define DBX_REGISTER_NUMBER(n)                         \
@@ -47,8 +54,9 @@ Boston, MA 02110-1301, USA.  */
    target, always use the svr4_dbx_register_map for DWARF .eh_frame
    even if we don't use DWARF .debug_frame. */
 #undef DWARF_FRAME_REGNUM
-#define DWARF_FRAME_REGNUM(n) TARGET_64BIT \
-       ? dbx64_register_map[(n)] : svr4_dbx_register_map[(n)] 
+#define DWARF_FRAME_REGNUM(n)                          \
+  (TARGET_64BIT ? dbx64_register_map[(n)]              \
+               : svr4_dbx_register_map[(n)])
 
 #ifdef HAVE_GAS_PE_SECREL32_RELOC
 /* Use section relative relocations for debugging offsets.  Unlike
@@ -56,7 +64,7 @@ Boston, MA 02110-1301, USA.  */
    won't allow it.  */
 #define ASM_OUTPUT_DWARF_OFFSET(FILE, SIZE, LABEL, SECTION)    \
   do {                                                         \
-    if (SIZE != 4)                                             \
+    if (SIZE != 4 && (!TARGET_64BIT || SIZE != 8))             \
       abort ();                                                        \
                                                                \
     fputs ("\t.secrel32\t", FILE);                             \
@@ -68,27 +76,27 @@ Boston, MA 02110-1301, USA.  */
 
 #include <stdio.h>
 
-#define MAYBE_UWIN_CPP_BUILTINS() /* Nothing.  */
-
 #define TARGET_OS_CPP_BUILTINS()                                       \
   do                                                                   \
     {                                                                  \
-       builtin_define ("_X86_=1");                                     \
+       if (!TARGET_64BIT)                                              \
+         builtin_define ("_X86_=1");                                   \
        builtin_assert ("system=winnt");                                \
        builtin_define ("__stdcall=__attribute__((__stdcall__))");      \
        builtin_define ("__fastcall=__attribute__((__fastcall__))");    \
+       builtin_define ("__thiscall=__attribute__((__thiscall__))");    \
        builtin_define ("__cdecl=__attribute__((__cdecl__))");          \
        if (!flag_iso)                                                  \
          {                                                             \
            builtin_define ("_stdcall=__attribute__((__stdcall__))");   \
            builtin_define ("_fastcall=__attribute__((__fastcall__))"); \
+           builtin_define ("_thiscall=__attribute__((__thiscall__))"); \
            builtin_define ("_cdecl=__attribute__((__cdecl__))");       \
          }                                                             \
        /* Even though linkonce works with static libs, this is needed  \
            to compare typeinfo symbols across dll boundaries.  */      \
        builtin_define ("__GXX_MERGED_TYPEINFO_NAMES=0");               \
        builtin_define ("__GXX_TYPEINFO_EQUALITY_INLINE=0");            \
-       MAYBE_UWIN_CPP_BUILTINS ();                                     \
        EXTRA_OS_CPP_BUILTINS ();                                       \
   }                                                                    \
   while (0)
@@ -124,22 +132,8 @@ Boston, MA 02110-1301, USA.  */
 #undef LONG_TYPE_SIZE
 #define LONG_TYPE_SIZE 32
 \f
-#undef REG_PARM_STACK_SPACE
-#define REG_PARM_STACK_SPACE(FNDECL) (TARGET_64BIT_MS_ABI ? 32 : 0)
-
-#undef OUTGOING_REG_PARM_STACK_SPACE
-#define OUTGOING_REG_PARM_STACK_SPACE (TARGET_64BIT_MS_ABI ? 1 : 0)
-
-#undef REGPARM_MAX
-#define REGPARM_MAX (TARGET_64BIT_MS_ABI ? 4 : 3)
-
-#undef SSE_REGPARM_MAX
-#define SSE_REGPARM_MAX (TARGET_64BIT_MS_ABI ? 4 : TARGET_SSE ? 3 : 0)
-\f
 /* Enable parsing of #pragma pack(push,<n>) and #pragma pack(pop).  */
 #define HANDLE_PRAGMA_PACK_PUSH_POP 1
-/* Enable push_macro & pop_macro */
-#define HANDLE_PRAGMA_PUSH_POP_MACRO 1
 
 union tree_node;
 #define TREE union tree_node *
@@ -184,8 +178,6 @@ do {                                                                        \
    Note that we can be called twice on the same decl.  */
 
 #define SUBTARGET_ENCODE_SECTION_INFO  i386_pe_encode_section_info
-#undef  TARGET_STRIP_NAME_ENCODING
-#define TARGET_STRIP_NAME_ENCODING  i386_pe_strip_name_encoding_full
 
 /* Output a common block.  */
 #undef ASM_OUTPUT_ALIGNED_DECL_COMMON
@@ -200,13 +192,24 @@ do {                                                      \
   ASM_OUTPUT_LABEL ((STREAM), (NAME));                 \
 } while (0)
 
+/* Output a reference to a label. Fastcall function symbols
+   keep their '@' prefix, while other symbols are prefixed
+   with user_label_prefix.  */
+#undef ASM_OUTPUT_LABELREF
+#define  ASM_OUTPUT_LABELREF(STREAM, NAME)     \
+do {                                           \
+  if ((NAME)[0] != FASTCALL_PREFIX)            \
+    fputs (user_label_prefix, (STREAM));       \
+  fputs ((NAME), (STREAM));                    \
+} while (0)
+
 \f
 /* Emit code to check the stack when allocating more than 4000
    bytes in one go.  */
 #define CHECK_STACK_LIMIT 4000
 
 #undef STACK_BOUNDARY
-#define STACK_BOUNDARY (TARGET_64BIT_MS_ABI ? 128 : BITS_PER_WORD)
+#define STACK_BOUNDARY (ix86_abi == MS_ABI ? 128 : BITS_PER_WORD)
 
 /* By default, target has a 80387, uses IEEE compatible arithmetic,
    returns float values in the 387 and needs stack probes.
@@ -217,6 +220,10 @@ do {                                                       \
        (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS \
         | MASK_STACK_PROBE | MASK_ALIGN_DOUBLE)
 
+#undef TARGET_SUBTARGET64_DEFAULT
+#define TARGET_SUBTARGET64_DEFAULT \
+       MASK_128BIT_LONG_DOUBLE
+
 /* This is how to output an assembler line
    that says to advance the location counter
    to a multiple of 2**LOG bytes.  */
@@ -280,12 +287,16 @@ do {                                                      \
 #define ASM_COMMENT_START " #"
 
 #ifndef DWARF2_UNWIND_INFO
-/* 64-bit target uses DWARF2 unwind by default. If 32-bit target
-   configured with --disable-sjlj-exceptions, use DWARF2, else default
-   to SJLJ.  */
-#if TARGET_64BIT_DEFAULT \
-    || (defined (CONFIG_SJLJ_EXCEPTIONS) && !CONFIG_SJLJ_EXCEPTIONS)
+/* If configured with --disable-sjlj-exceptions, use DWARF2, else
+   default to SJLJ.  */
+#if  (defined (CONFIG_SJLJ_EXCEPTIONS) && !CONFIG_SJLJ_EXCEPTIONS)
+/* The logic of this #if must be kept synchronised with the logic
+   for selecting the tmake_eh_file fragment in config.gcc.  */
 #define DWARF2_UNWIND_INFO 1
+/* If multilib is selected break build as sjlj is required.  */
+#if defined (TARGET_BI_ARCH)
+#error For 64-bit windows and 32-bit based multilib version of gcc just SJLJ exceptions are supported.
+#endif
 #else
 #define DWARF2_UNWIND_INFO 0
 #endif
@@ -321,10 +332,6 @@ do {                                                       \
 #undef MS_AGGREGATE_RETURN
 #define MS_AGGREGATE_RETURN 1
 
-/* No data type wants to be aligned rounder than this.  */
-#undef BIGGEST_ALIGNMENT
-#define BIGGEST_ALIGNMENT 128
-
 /* Biggest alignment supported by the object file format of this
    machine.  Use this macro to limit the alignment which can be
    specified using the `__attribute__ ((aligned (N)))' construct.  If
@@ -335,9 +342,13 @@ do {                                                       \
 #undef MAX_OFILE_ALIGNMENT
 #define MAX_OFILE_ALIGNMENT (8192 * 8)
 
-/* Native complier aligns internal doubles in structures on dword boundaries.  */
+/* BIGGEST_FIELD_ALIGNMENT macro is used directly by libobjc, There, we
+   align internal doubles in structures on dword boundaries. Otherwise,
+   support vector modes using ADJUST_FIELD_ALIGN, defined in i386.h.  */
+#ifdef IN_TARGET_LIBS
 #undef BIGGEST_FIELD_ALIGNMENT
 #define BIGGEST_FIELD_ALIGNMENT 64
+#endif
 
 /* A bit-field declared as `int' forces `int' alignment for the struct.  */
 #undef PCC_BITFIELD_TYPE_MATTERS
@@ -357,6 +368,7 @@ do {                                                        \
     {                                                                  \
       const char *alias                                                        \
        = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL));              \
+      i386_pe_maybe_record_exported_symbol (DECL, alias, 0);           \
       if (TREE_CODE (DECL) == FUNCTION_DECL)                           \
        i386_pe_declare_function_type (STREAM, alias,                   \
                                       TREE_PUBLIC (DECL));             \
@@ -378,7 +390,7 @@ do {                                                        \
 /* FIXME: SUPPORTS_WEAK && TARGET_HAVE_NAMED_SECTIONS is true,
    but for .jcr section to work we also need crtbegin and crtend
    objects.  */
-#define TARGET_USE_JCR_SECTION 0
+#define TARGET_USE_JCR_SECTION 1
 
 /* Decide whether it is safe to use a local alias for a virtual function
    when constructing thunks.  */