OSDN Git Service

Revert:
[pf3gnuchains/gcc-fork.git] / gcc / config / i386 / cygming.h
index 99b0372..71a5d8d 100644 (file)
@@ -1,13 +1,14 @@
 /* Operating system specific defines to be used when targeting GCC for
    hosting on Windows32, using a Unix style C library and tools.
 /* 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
+   Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
+   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
    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,
 any later version.
 
 GCC is distributed in the hope that it will be useful,
@@ -16,72 +17,93 @@ 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
 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, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, 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
 
 #define DBX_DEBUGGING_INFO 1
 #define SDB_DEBUGGING_INFO 1
+#if TARGET_64BIT_DEFAULT || defined (HAVE_GAS_PE_SECREL32_RELOC)
+#define DWARF2_DEBUGGING_INFO 1
+#endif
+
 #undef PREFERRED_DEBUGGING_TYPE
 #undef PREFERRED_DEBUGGING_TYPE
+#if (DWARF2_DEBUGGING_INFO)
+#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
+#else
 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
+#endif
+
+#undef TARGET_64BIT_MS_ABI
+#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)                         \
+  (TARGET_64BIT ? dbx64_register_map[n]                        \
+   : (write_symbols == DWARF2_DEBUG                    \
+      ? svr4_dbx_register_map[n] : dbx_register_map[n]))
+
+/* Map gcc register number to DWARF 2 CFA column number. For 32 bit
+   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)])
+
+#ifdef HAVE_GAS_PE_SECREL32_RELOC
+/* Use section relative relocations for debugging offsets.  Unlike
+   other targets that fake this by putting the section VMA at 0, PE
+   won't allow it.  */
+#define ASM_OUTPUT_DWARF_OFFSET(FILE, SIZE, LABEL, SECTION)    \
+  do {                                                         \
+    if (SIZE != 4 && (!TARGET_64BIT || SIZE != 8))             \
+      abort ();                                                        \
+                                                               \
+    fputs ("\t.secrel32\t", FILE);                             \
+    assemble_name (FILE, LABEL);                               \
+  } while (0)
+#endif
 
 #define TARGET_EXECUTABLE_SUFFIX ".exe"
 
 #include <stdio.h>
 
 
 #define TARGET_EXECUTABLE_SUFFIX ".exe"
 
 #include <stdio.h>
 
-/* Masks for subtarget switches used by other files.  */
-#define MASK_NOP_FUN_DLLIMPORT 0x08000000 /* Ignore dllimport for functions */
-
-/* Used in winnt.c.  */
-#define TARGET_NOP_FUN_DLLIMPORT (target_flags & MASK_NOP_FUN_DLLIMPORT)
-
-#undef  SUBTARGET_SWITCHES
-#define SUBTARGET_SWITCHES \
-{ "cygwin",              0, N_("Use the Cygwin interface") },  \
-{ "no-cygwin",           0, N_("Use the Mingw32 interface") }, \
-{ "windows",             0, N_("Create GUI application") },    \
-{ "no-win32",            0, N_("Don't set Windows defines") }, \
-{ "win32",               0, N_("Set Windows defines") },       \
-{ "console",             0, N_("Create console application") },\
-{ "dll",                 0, N_("Generate code for a DLL") },   \
-{ "nop-fun-dllimport",   MASK_NOP_FUN_DLLIMPORT,               \
-  N_("Ignore dllimport for functions") },                      \
-{ "no-nop-fun-dllimport", -MASK_NOP_FUN_DLLIMPORT, "" },       \
-{ "threads",             0, N_("Use Mingw-specific thread support") },
-
-#define MAYBE_UWIN_CPP_BUILTINS() /* Nothing.  */
-
-/* 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
-   predefined attributes later on.  This can be solved by using one attribute,
-   say __declspec__, and passing args to it.  The problem with that approach
-   is that args are not accumulated: each new appearance would clobber any
-   existing args.  */
-
 #define TARGET_OS_CPP_BUILTINS()                                       \
   do                                                                   \
     {                                                                  \
 #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_assert ("system=winnt");                                \
        builtin_define ("__stdcall=__attribute__((__stdcall__))");      \
        builtin_define ("__fastcall=__attribute__((__fastcall__))");    \
+       builtin_define ("__thiscall=__attribute__((__thiscall__))");    \
        builtin_define ("__cdecl=__attribute__((__cdecl__))");          \
        builtin_define ("__cdecl=__attribute__((__cdecl__))");          \
-       builtin_define ("__declspec(x)=__attribute__((x))");            \
        if (!flag_iso)                                                  \
          {                                                             \
            builtin_define ("_stdcall=__attribute__((__stdcall__))");   \
            builtin_define ("_fastcall=__attribute__((__fastcall__))"); \
        if (!flag_iso)                                                  \
          {                                                             \
            builtin_define ("_stdcall=__attribute__((__stdcall__))");   \
            builtin_define ("_fastcall=__attribute__((__fastcall__))"); \
+           builtin_define ("_thiscall=__attribute__((__thiscall__))"); \
            builtin_define ("_cdecl=__attribute__((__cdecl__))");       \
          }                                                             \
            builtin_define ("_cdecl=__attribute__((__cdecl__))");       \
          }                                                             \
-       MAYBE_UWIN_CPP_BUILTINS ();                                     \
+       /* 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");            \
        EXTRA_OS_CPP_BUILTINS ();                                       \
   }                                                                    \
   while (0)
 
 /* Get tree.c to declare a target-specific specialization of
    merge_decl_attributes.  */
        EXTRA_OS_CPP_BUILTINS ();                                       \
   }                                                                    \
   while (0)
 
 /* Get tree.c to declare a target-specific specialization of
    merge_decl_attributes.  */
-#define TARGET_DLLIMPORT_DECL_ATTRIBUTES
+#define TARGET_DLLIMPORT_DECL_ATTRIBUTES 1
 
 /* This macro defines names of additional specifications to put in the specs
    that can be used in various specifications like CC1_SPEC.  Its definition
 
 /* This macro defines names of additional specifications to put in the specs
    that can be used in various specifications like CC1_SPEC.  Its definition
@@ -100,11 +122,15 @@ Boston, MA 02111-1307, USA.  */
 #undef MATH_LIBRARY
 #define MATH_LIBRARY ""
 
 #undef MATH_LIBRARY
 #define MATH_LIBRARY ""
 
-#define SIZE_TYPE "unsigned int"
-#define PTRDIFF_TYPE "int"
+#define SIZE_TYPE (TARGET_64BIT ? "long long unsigned int" : "unsigned int")
+#define PTRDIFF_TYPE (TARGET_64BIT ? "long long int" : "int")
+
 #define WCHAR_TYPE_SIZE 16
 #define WCHAR_TYPE "short unsigned int"
 
 #define WCHAR_TYPE_SIZE 16
 #define WCHAR_TYPE "short unsigned int"
 
+/* Windows64 continues to use a 32-bit long type.  */
+#undef LONG_TYPE_SIZE
+#define LONG_TYPE_SIZE 32
 \f
 /* Enable parsing of #pragma pack(push,<n>) and #pragma pack(pop).  */
 #define HANDLE_PRAGMA_PACK_PUSH_POP 1
 \f
 /* Enable parsing of #pragma pack(push,<n>) and #pragma pack(pop).  */
 #define HANDLE_PRAGMA_PACK_PUSH_POP 1
@@ -112,52 +138,14 @@ Boston, MA 02111-1307, USA.  */
 union tree_node;
 #define TREE union tree_node *
 \f
 union tree_node;
 #define TREE union tree_node *
 \f
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_drectve
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS                                        \
-  DRECTVE_SECTION_FUNCTION                                     \
-  SWITCH_TO_SECTION_FUNCTION
-
-#define DRECTVE_SECTION_FUNCTION \
-void                                                                   \
-drectve_section (void)                                                 \
-{                                                                      \
-  if (in_section != in_drectve)                                                \
-    {                                                                  \
-      fprintf (asm_out_file, "%s\n", "\t.section .drectve\n");         \
-      in_section = in_drectve;                                         \
-    }                                                                  \
-}
-void drectve_section (void);
+#define drectve_section() \
+  (fprintf (asm_out_file, "\t.section .drectve\n"), \
+   in_section = NULL)
 
 /* Older versions of gas don't handle 'r' as data.
    Explicitly set data flag with 'd'.  */  
 #define READONLY_DATA_SECTION_ASM_OP "\t.section .rdata,\"dr\""
 
 
 /* Older versions of gas don't handle 'r' as data.
    Explicitly set data flag with 'd'.  */  
 #define READONLY_DATA_SECTION_ASM_OP "\t.section .rdata,\"dr\""
 
-/* Switch to SECTION (an `enum in_section').
-
-   ??? This facility should be provided by GCC proper.
-   The problem is that we want to temporarily switch sections in
-   ASM_DECLARE_OBJECT_NAME and then switch back to the original section
-   afterwards.  */
-#define SWITCH_TO_SECTION_FUNCTION                             \
-void switch_to_section (enum in_section, tree);                        \
-void                                                           \
-switch_to_section (enum in_section section, tree decl)         \
-{                                                              \
-  switch (section)                                             \
-    {                                                          \
-      case in_text: text_section (); break;                    \
-      case in_data: data_section (); break;                    \
-      case in_readonly_data: readonly_data_section (); break;  \
-      case in_named: named_section (decl, NULL, 0); break;     \
-      case in_drectve: drectve_section (); break;              \
-      default: abort (); break;                                \
-    }                                                          \
-}
-
 /* Don't allow flag_pic to propagate since gas may produce invalid code
    otherwise.  */
 
 /* Don't allow flag_pic to propagate since gas may produce invalid code
    otherwise.  */
 
@@ -166,7 +154,7 @@ switch_to_section (enum in_section section, tree decl)              \
 do {                                                                   \
   if (flag_pic)                                                                \
     {                                                                  \
 do {                                                                   \
   if (flag_pic)                                                                \
     {                                                                  \
-      warning ("-f%s ignored for target (all code is position independent)",\
+      warning (0, "-f%s ignored for target (all code is position independent)",\
               (flag_pic > 1) ? "PIC" : "pic");                         \
       flag_pic = 0;                                                    \
     }                                                                  \
               (flag_pic > 1) ? "PIC" : "pic");                         \
       flag_pic = 0;                                                    \
     }                                                                  \
@@ -189,53 +177,52 @@ do {                                                                      \
    section and we need to set DECL_SECTION_NAME so we do that here.
    Note that we can be called twice on the same decl.  */
 
    section and we need to set DECL_SECTION_NAME so we do that here.
    Note that we can be called twice on the same decl.  */
 
-#undef TARGET_ENCODE_SECTION_INFO
-#define TARGET_ENCODE_SECTION_INFO  i386_pe_encode_section_info
-#undef  TARGET_STRIP_NAME_ENCODING
-#define TARGET_STRIP_NAME_ENCODING  i386_pe_strip_name_encoding_full
-\f
-/* Output a reference to a label.  */
-#undef ASM_OUTPUT_LABELREF
-#define ASM_OUTPUT_LABELREF  i386_pe_output_labelref
+#define SUBTARGET_ENCODE_SECTION_INFO  i386_pe_encode_section_info
 
 /* Output a common block.  */
 
 /* Output a common block.  */
-#undef ASM_OUTPUT_COMMON
-#define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \
-do {                                                   \
-  if (i386_pe_dllexport_name_p (NAME))                 \
-    i386_pe_record_exported_symbol (NAME, 1);          \
-  if (! i386_pe_dllimport_name_p (NAME))               \
-    {                                                  \
-      fprintf ((STREAM), "\t.comm\t");                 \
-      assemble_name ((STREAM), (NAME));                        \
-      fprintf ((STREAM), ", %d\t%s %d\n",              \
-              (int)(ROUNDED), ASM_COMMENT_START, (int)(SIZE)); \
-    }                                                  \
-} while (0)
+#undef ASM_OUTPUT_ALIGNED_DECL_COMMON
+#define ASM_OUTPUT_ALIGNED_DECL_COMMON \
+  i386_pe_asm_output_aligned_decl_common
 
 /* Output the label for an initialized variable.  */
 #undef ASM_DECLARE_OBJECT_NAME
 #define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL)    \
 do {                                                   \
 
 /* Output the label for an initialized variable.  */
 #undef ASM_DECLARE_OBJECT_NAME
 #define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL)    \
 do {                                                   \
-  if (i386_pe_dllexport_name_p (NAME))                 \
-    i386_pe_record_exported_symbol (NAME, 1);          \
+  i386_pe_maybe_record_exported_symbol (DECL, NAME, 1);        \
   ASM_OUTPUT_LABEL ((STREAM), (NAME));                 \
 } while (0)
 
   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
 \f
-/* Emit code to check the stack when allocating more that 4000
+/* Emit code to check the stack when allocating more than 4000
    bytes in one go.  */
    bytes in one go.  */
-
 #define CHECK_STACK_LIMIT 4000
 
 #define CHECK_STACK_LIMIT 4000
 
+#undef STACK_BOUNDARY
+#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.
 /* By default, target has a 80387, uses IEEE compatible arithmetic,
    returns float values in the 387 and needs stack probes.
-   We also align doubles to 64-bits for MSVC default compatibility. */
+   We also align doubles to 64-bits for MSVC default compatibility.  */
 
 #undef TARGET_SUBTARGET_DEFAULT
 #define TARGET_SUBTARGET_DEFAULT \
 
 #undef TARGET_SUBTARGET_DEFAULT
 #define TARGET_SUBTARGET_DEFAULT \
-   (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_STACK_PROBE \
-    | MASK_ALIGN_DOUBLE)
+       (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
 
 /* This is how to output an assembler line
    that says to advance the location counter
@@ -245,14 +232,11 @@ do {                                                      \
 #define ASM_OUTPUT_ALIGN(FILE,LOG)     \
     if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG))
 
 #define ASM_OUTPUT_ALIGN(FILE,LOG)     \
     if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG))
 
-/* Define this macro if in some cases global symbols from one translation
-   unit may not be bound to undefined symbols in another translation unit
-   without user intervention.  For instance, under Microsoft Windows
-   symbols must be explicitly imported from shared libraries (DLLs).  */
-#define MULTIPLE_SYMBOL_SPACES
+/* Windows uses explicit import from shared libraries.  */
+#define MULTIPLE_SYMBOL_SPACES 1
 
 
-extern void i386_pe_unique_section (TREE, int);
 #define TARGET_ASM_UNIQUE_SECTION i386_pe_unique_section
 #define TARGET_ASM_UNIQUE_SECTION i386_pe_unique_section
+#define TARGET_ASM_FUNCTION_RODATA_SECTION default_no_function_rodata_section
 
 #define SUPPORTS_ONE_ONLY 1
 
 
 #define SUPPORTS_ONE_ONLY 1
 
@@ -269,8 +253,7 @@ extern void i386_pe_unique_section (TREE, int);
 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)                    \
   do                                                                   \
     {                                                                  \
 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)                    \
   do                                                                   \
     {                                                                  \
-      if (i386_pe_dllexport_name_p (NAME))                             \
-       i386_pe_record_exported_symbol (NAME, 0);                       \
+      i386_pe_maybe_record_exported_symbol (DECL, NAME, 0);            \
       if (write_symbols != SDB_DEBUG)                                  \
        i386_pe_declare_function_type (FILE, NAME, TREE_PUBLIC (DECL)); \
       ASM_OUTPUT_LABEL (FILE, NAME);                                   \
       if (write_symbols != SDB_DEBUG)                                  \
        i386_pe_declare_function_type (FILE, NAME, TREE_PUBLIC (DECL)); \
       ASM_OUTPUT_LABEL (FILE, NAME);                                   \
@@ -283,7 +266,7 @@ extern void i386_pe_unique_section (TREE, int);
   do                                                                   \
     {                                                                  \
       if (TREE_CODE (DECL) == FUNCTION_DECL)                           \
   do                                                                   \
     {                                                                  \
       if (TREE_CODE (DECL) == FUNCTION_DECL)                           \
-       i386_pe_record_external_function (NAME);                        \
+       i386_pe_record_external_function ((DECL), (NAME));              \
     }                                                                  \
   while (0)
 
     }                                                                  \
   while (0)
 
@@ -303,10 +286,21 @@ extern void i386_pe_unique_section (TREE, int);
 #undef ASM_COMMENT_START
 #define ASM_COMMENT_START " #"
 
 #undef ASM_COMMENT_START
 #define ASM_COMMENT_START " #"
 
-/* DWARF2 Unwinding doesn't work with exception handling yet.  To make
-   it work, we need to build a libgcc_s.dll, and dcrt0.o should be
-   changed to call __register_frame_info/__deregister_frame_info.  */
+#ifndef DWARF2_UNWIND_INFO
+/* 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
 #define DWARF2_UNWIND_INFO 0
+#endif
+#endif
 
 /* Don't assume anything about the header files.  */
 #define NO_IMPLICIT_EXTERN_C
 
 /* Don't assume anything about the header files.  */
 #define NO_IMPLICIT_EXTERN_C
@@ -315,7 +309,7 @@ extern void i386_pe_unique_section (TREE, int);
 #define PROFILE_HOOK(LABEL)                                            \
   if (MAIN_NAME_P (DECL_NAME (current_function_decl)))                 \
     {                                                                  \
 #define PROFILE_HOOK(LABEL)                                            \
   if (MAIN_NAME_P (DECL_NAME (current_function_decl)))                 \
     {                                                                  \
-      emit_call_insn (gen_rtx (CALL, VOIDmode,                         \
+      emit_call_insn (gen_rtx_CALL (VOIDmode,                          \
        gen_rtx_MEM (FUNCTION_MODE,                                     \
                     gen_rtx_SYMBOL_REF (Pmode, "_monstartup")),        \
        const0_rtx));                                                   \
        gen_rtx_MEM (FUNCTION_MODE,                                     \
                     gen_rtx_SYMBOL_REF (Pmode, "_monstartup")),        \
        const0_rtx));                                                   \
@@ -329,15 +323,6 @@ extern void i386_pe_unique_section (TREE, int);
                               build_tree_list (get_identifier ("stdcall"),   \
                                                NULL))
 
                               build_tree_list (get_identifier ("stdcall"),   \
                                                NULL))
 
-/* External function declarations.  */
-
-extern void i386_pe_record_external_function (const char *);
-extern void i386_pe_declare_function_type (FILE *, const char *, int);
-extern void i386_pe_record_exported_symbol (const char *, int);
-extern void i386_pe_file_end (void);
-extern int i386_pe_dllexport_name_p (const char *);
-extern int i386_pe_dllimport_name_p (const char *);
-
 /* For Win32 ABI compatibility */
 #undef DEFAULT_PCC_STRUCT_RETURN
 #define DEFAULT_PCC_STRUCT_RETURN 0
 /* For Win32 ABI compatibility */
 #undef DEFAULT_PCC_STRUCT_RETURN
 #define DEFAULT_PCC_STRUCT_RETURN 0
@@ -347,13 +332,23 @@ extern int i386_pe_dllimport_name_p (const char *);
 #undef MS_AGGREGATE_RETURN
 #define MS_AGGREGATE_RETURN 1
 
 #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
-
-/* Native complier aligns internal doubles in structures on dword boundaries.  */
+/* 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
+   not defined, the default value is `BIGGEST_ALIGNMENT'.  */
+/* IMAGE_SCN_ALIGN_8192BYTES is the largest section alignment flag
+   specified in the PECOFF60 spec.  Native MS compiler also limits
+   user-specified alignment to 8192 bytes.  */
+#undef MAX_OFILE_ALIGNMENT
+#define MAX_OFILE_ALIGNMENT (8192 * 8)
+
+/* 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
 #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
 
 /* A bit-field declared as `int' forces `int' alignment for the struct.  */
 #undef PCC_BITFIELD_TYPE_MATTERS
@@ -364,24 +359,56 @@ extern int i386_pe_dllimport_name_p (const char *);
 #ifndef SET_ASM_OP
 #define SET_ASM_OP "\t.set\t"
 #endif
 #ifndef SET_ASM_OP
 #define SET_ASM_OP "\t.set\t"
 #endif
+
 /* This implements the `alias' attribute, keeping any stdcall or
    fastcall decoration.  */
 #undef ASM_OUTPUT_DEF_FROM_DECLS
 /* This implements the `alias' attribute, keeping any stdcall or
    fastcall decoration.  */
 #undef ASM_OUTPUT_DEF_FROM_DECLS
-#define        ASM_OUTPUT_DEF_FROM_DECLS(STREAM, DECL, TARGET)                 \
+#define        ASM_OUTPUT_DEF_FROM_DECLS(STREAM, DECL, TARGET)                 \
   do                                                                   \
     {                                                                  \
   do                                                                   \
     {                                                                  \
-      const char *alias;                                               \
-      rtx rtlname = XEXP (DECL_RTL (DECL), 0);                         \
-      if (GET_CODE (rtlname) == SYMBOL_REF)                            \
-       alias = XSTR (rtlname, 0);                                      \
-      else                                                             \
-       abort ();                                                       \
+      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));             \
       ASM_OUTPUT_DEF (STREAM, alias, IDENTIFIER_POINTER (TARGET));     \
     } while (0)
 
       if (TREE_CODE (DECL) == FUNCTION_DECL)                           \
        i386_pe_declare_function_type (STREAM, alias,                   \
                                       TREE_PUBLIC (DECL));             \
       ASM_OUTPUT_DEF (STREAM, alias, IDENTIFIER_POINTER (TARGET));     \
     } while (0)
 
+/* GNU as supports weak symbols on PECOFF. */
+#ifdef HAVE_GAS_WEAK
+#define ASM_WEAKEN_LABEL(FILE, NAME)  \
+  do                                  \
+    {                                 \
+      fputs ("\t.weak\t", (FILE));    \
+      assemble_name ((FILE), (NAME)); \
+      fputc ('\n', (FILE));           \
+    }                                 \
+  while (0)
+#endif /* HAVE_GAS_WEAK */
+
+/* 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 1
+
+/* Decide whether it is safe to use a local alias for a virtual function
+   when constructing thunks.  */
+#undef TARGET_USE_LOCAL_THUNK_ALIAS_P
+#define TARGET_USE_LOCAL_THUNK_ALIAS_P(DECL) (!DECL_ONE_ONLY (DECL))
+
+#define SUBTARGET_ATTRIBUTE_TABLE \
+  { "selectany", 0, 0, true, false, false, ix86_handle_selectany_attribute }
+  /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */
+
+/*  mcount() does not need a counter variable.  */
+#undef NO_PROFILE_COUNTERS
+#define NO_PROFILE_COUNTERS 1
+
+#define TARGET_VALID_DLLIMPORT_ATTRIBUTE_P i386_pe_valid_dllimport_attribute_p
+#define TARGET_CXX_ADJUST_CLASS_AT_DEFINITION i386_pe_adjust_class_at_definition
+#define TARGET_MANGLE_DECL_ASSEMBLER_NAME i386_pe_mangle_decl_assembler_name
+
 #undef TREE
 
 #ifndef BUFSIZ
 #undef TREE
 
 #ifndef BUFSIZ