Mercurial > hg > CbC > CbC_gcc
diff gcc/config/i386/mingw32.h @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | f6334be47118 |
children | 84e7813d76e9 |
line wrap: on
line diff
--- a/gcc/config/i386/mingw32.h Sun Aug 21 07:07:55 2011 +0900 +++ b/gcc/config/i386/mingw32.h Fri Oct 27 22:46:09 2017 +0900 @@ -1,7 +1,6 @@ /* Operating system specific defines to be used when targeting GCC for hosting on Windows32, using GNU tools and the Windows32 API Library. - Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2007, 2008, - 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1997-2017 Free Software Foundation, Inc. This file is part of GCC. @@ -19,12 +18,19 @@ along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>. */ -#undef TARGET_VERSION -#if TARGET_64BIT_DEFAULT -#define TARGET_VERSION fprintf (stderr,"(x86_64 MinGW"); -#else -#define TARGET_VERSION fprintf (stderr," (x86 MinGW)"); -#endif +#undef DEFAULT_ABI +#define DEFAULT_ABI MS_ABI + +/* 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. + Additionally we enable MS_BITFIELD_LAYOUT by default. */ + +#undef TARGET_SUBTARGET_DEFAULT +#define TARGET_SUBTARGET_DEFAULT \ + (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS \ + | MASK_STACK_PROBE | MASK_ALIGN_DOUBLE \ + | MASK_MS_BITFIELD_LAYOUT) /* See i386/crtdll.h for an alternative definition. _INTEGRAL_MAX_BITS is for compatibility with native compiler. */ @@ -47,6 +53,14 @@ } \ while (0) +#ifndef TARGET_USE_PTHREAD_BY_DEFAULT +#define SPEC_PTHREAD1 "pthread" +#define SPEC_PTHREAD2 "!no-pthread" +#else +#define SPEC_PTHREAD1 "!no-pthread" +#define SPEC_PTHREAD2 "pthread" +#endif + #undef SUB_LINK_ENTRY32 #undef SUB_LINK_ENTRY64 #define SUB_LINK_ENTRY32 "-e _DllMainCRTStartup@12" @@ -63,31 +77,35 @@ #define SUB_LINK_ENTRY SUB_LINK_ENTRY32 #endif -/* Override the standard choice of /usr/include as the default prefix - to try when searching for header files. */ -#undef STANDARD_INCLUDE_DIR -#define STANDARD_INCLUDE_DIR "/mingw/include" -#undef STANDARD_INCLUDE_COMPONENT -#define STANDARD_INCLUDE_COMPONENT "MINGW" +#undef NATIVE_SYSTEM_HEADER_COMPONENT +#define NATIVE_SYSTEM_HEADER_COMPONENT "MINGW" #undef CPP_SPEC -#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT}" +#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT} " \ + "%{" SPEC_PTHREAD1 ":-D_REENTRANT} " \ + "%{" SPEC_PTHREAD2 ": } " /* For Windows applications, include more libraries, but always include kernel32. */ #undef LIB_SPEC -#define LIB_SPEC "%{pg:-lgmon} %{mwindows:-lgdi32 -lcomdlg32} \ - -ladvapi32 -lshell32 -luser32 -lkernel32" +#define LIB_SPEC "%{pg:-lgmon} %{" SPEC_PTHREAD1 ":-lpthread} " \ + "%{" SPEC_PTHREAD2 ": } " \ + "%{mwindows:-lgdi32 -lcomdlg32} " \ + "%{fvtable-verify=preinit:-lvtv -lpsapi; \ + fvtable-verify=std:-lvtv -lpsapi} " \ + "-ladvapi32 -lshell32 -luser32 -lkernel32" /* Weak symbols do not get resolved if using a Windows dll import lib. Make the unwind registration references strong undefs. */ #if DWARF2_UNWIND_INFO /* DW2-unwind is just available for 32-bit mode. */ #if TARGET_64BIT_DEFAULT -#error DW2 unwind is not available for 64-bit. -#endif +#define SHARED_LIBGCC_UNDEFS_SPEC \ + "%{m32: %{shared-libgcc: -u ___register_frame_info -u ___deregister_frame_info}}" +#else #define SHARED_LIBGCC_UNDEFS_SPEC \ "%{shared-libgcc: -u ___register_frame_info -u ___deregister_frame_info}" +#endif #else #define SHARED_LIBGCC_UNDEFS_SPEC "" #endif @@ -106,25 +124,41 @@ /* Include in the mingw32 libraries with libgcc */ #ifdef ENABLE_SHARED_LIBGCC -#define SHARED_LIBGCC_SPEC "%{shared-libgcc:-lgcc_s} %{!shared-libgcc:-lgcc_eh}" +#define SHARED_LIBGCC_SPEC " \ + %{static|static-libgcc:-lgcc -lgcc_eh} \ + %{!static: \ + %{!static-libgcc: \ + %{!shared: \ + %{!shared-libgcc:-lgcc -lgcc_eh} \ + %{shared-libgcc:-lgcc_s -lgcc} \ + } \ + %{shared:-lgcc_s -lgcc} \ + } \ + } " #else -#define SHARED_LIBGCC_SPEC /*empty*/ +#define SHARED_LIBGCC_SPEC " -lgcc " #endif #undef REAL_LIBGCC_SPEC #define REAL_LIBGCC_SPEC \ "%{mthreads:-lmingwthrd} -lmingw32 \ - "SHARED_LIBGCC_SPEC" \ - -lgcc \ + " SHARED_LIBGCC_SPEC " \ -lmoldname -lmingwex -lmsvcrt" #undef STARTFILE_SPEC #define STARTFILE_SPEC "%{shared|mdll:dllcrt2%O%s} \ %{!shared:%{!mdll:crt2%O%s}} %{pg:gcrt2%O%s} \ - crtbegin.o%s" + crtbegin.o%s \ + %{fvtable-verify=none:%s; \ + fvtable-verify=preinit:vtv_start.o%s; \ + fvtable-verify=std:vtv_start.o%s}" #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ + "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ + %{!shared:%:if-exists(default-manifest.o%s)}\ + %{fvtable-verify=none:%s; \ + fvtable-verify=preinit:vtv_end.o%s; \ + fvtable-verify=std:vtv_end.o%s} \ crtend.o%s" /* Override startfile prefix defaults. */ @@ -135,17 +169,23 @@ #define STANDARD_STARTFILE_PREFIX_2 "" #endif +/* For native mingw-version we need to take care that NATIVE_SYSTEM_HEADER_DIR + macro contains POSIX-style path. See bug 52947. */ +#undef NATIVE_SYSTEM_HEADER_DIR +#define NATIVE_SYSTEM_HEADER_DIR "/mingw/include" + /* Output STRING, a string representing a filename, to FILE. We canonicalize it to be in Unix format (backslashes are replaced forward slashes. */ #undef OUTPUT_QUOTED_STRING #define OUTPUT_QUOTED_STRING(FILE, STRING) \ do { \ + const char *_string = (const char *) (STRING); \ char c; \ \ - putc ('\"', asm_file); \ + putc ('\"', (FILE)); \ \ - while ((c = *string++) != 0) \ + while ((c = *_string++) != 0) \ { \ if (c == '\\') \ c = '/'; \ @@ -153,14 +193,14 @@ if (ISPRINT (c)) \ { \ if (c == '\"') \ - putc ('\\', asm_file); \ - putc (c, asm_file); \ + putc ('\\', (FILE)); \ + putc (c, (FILE)); \ } \ else \ - fprintf (asm_file, "\\%03o", (unsigned char) c); \ + fprintf ((FILE), "\\%03o", (unsigned char) c); \ } \ \ - putc ('\"', asm_file); \ + putc ('\"', (FILE)); \ } while (0) /* Define as short unsigned for compatibility with MS runtime. */ @@ -169,7 +209,10 @@ /* mingw32 uses the -mthreads option to enable thread support. */ #undef GOMP_SELF_SPECS -#define GOMP_SELF_SPECS "%{fopenmp: -mthreads}" +#define GOMP_SELF_SPECS "%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1): " \ + "-mthreads -pthread}" +#undef GTM_SELF_SPECS +#define GTM_SELF_SPECS "%{fgnu-tm:-mthreads -pthread}" /* mingw32 atexit function is safe to use in shared libraries. Use it to register C++ static destructors. */ @@ -196,37 +239,10 @@ #undef TARGET_N_FORMAT_TYPES #define TARGET_N_FORMAT_TYPES 3 -/* Let defaults.h definition of TARGET_USE_JCR_SECTION apply. */ -#undef TARGET_USE_JCR_SECTION - -#undef MINGW_ENABLE_EXECUTE_STACK -#define MINGW_ENABLE_EXECUTE_STACK \ -extern void __enable_execute_stack (void *); \ -void \ -__enable_execute_stack (void *addr) \ -{ \ - MEMORY_BASIC_INFORMATION b; \ - if (!VirtualQuery (addr, &b, sizeof(b))) \ - abort (); \ - VirtualProtect (b.BaseAddress, b.RegionSize, PAGE_EXECUTE_READWRITE, \ - &b.Protect); \ -} - -#undef ENABLE_EXECUTE_STACK -#define ENABLE_EXECUTE_STACK MINGW_ENABLE_EXECUTE_STACK +#define HAVE_ENABLE_EXECUTE_STACK #undef CHECK_EXECUTE_STACK_ENABLED #define CHECK_EXECUTE_STACK_ENABLED flag_setstackexecutable -#ifdef IN_LIBGCC2 -#include <windows.h> -#endif - -/* For 64-bit Windows we can't use DW2 unwind info. Also for multilib - builds we can't use it, too. */ -#if !TARGET_64BIT_DEFAULT && !defined (TARGET_BI_ARCH) -#define MD_UNWIND_SUPPORT "config/i386/w32-unwind.h" -#endif - /* This matches SHLIB_SONAME and SHLIB_SOVERSION in t-cygming. */ /* This matches SHLIB_SONAME and SHLIB_SOVERSION in t-cygwin. */ #if DWARF2_UNWIND_INFO @@ -236,6 +252,3 @@ #endif #define LIBGCC_SONAME "libgcc_s" LIBGCC_EH_EXTN "-1.dll" -/* We should find a way to not have to update this manually. */ -#define LIBGCJ_SONAME "libgcj" /*LIBGCC_EH_EXTN*/ "-12.dll" -