diff options
author | Kai Tietz <ktietz@gcc.gnu.org> | 2011-04-01 16:43:22 +0200 |
---|---|---|
committer | Kai Tietz <ktietz@gcc.gnu.org> | 2011-04-01 16:43:22 +0200 |
commit | c04bdac028f5292634f5c02432226934ef7980e4 (patch) | |
tree | f4a47a001369eb5cf6ae62193100fdcf56e41ec1 | |
parent | 636b4106f693484fe21032b7acb2d0c3f43fe165 (diff) | |
download | gcc-c04bdac028f5292634f5c02432226934ef7980e4.zip gcc-c04bdac028f5292634f5c02432226934ef7980e4.tar.gz gcc-c04bdac028f5292634f5c02432226934ef7980e4.tar.bz2 |
config.gcc (*-*-mingw*): Allow as option the posix threading model.
2011-04-01 Kai Tietz <ktietz@redhat.com>
* config.gcc (*-*-mingw*): Allow as option the
posix threading model.
* config/i386/mingw32.h ( SPEC_PTHREAD1, SPEC_PTHREAD2):
New macros defined dependent to TARGET_USE_PTHREAD_BY_DEFAULT
definition.
(CPP_SPEC): Add pthread/no-pthread handling.
(LIB_SPEC): Likewise.
* config/i386/mingw-w64.h (CPP_SPEC):Likewise.
(LIB_SPEC): Likewise.
* config/i386/t-cygming (SHLIB_PTHREAD_CFLAG): New
flag to pass -pthread option for shared libgcc build.
(SHLIB_PTHREAD_LDFLAG): New option to pass -lpthread
for shared libgcc build.
* config/i386/t-mingw-pthread: New file.
* config/i386/mingw-pthread.h (TARGET_USE_PTHREAD_BY_DEFAULT):
New define to enable use of library pthread by default.
* config/i386/mingw.opt (pthread): New driver option.
(no-pthread): New driver option.
* config/i386/cygming.opt: Make sure trailing empty line
is retained.
* config/i386/mingw-w64.opt: Likewise.
From-SVN: r171833
-rw-r--r-- | gcc/config.gcc | 14 | ||||
-rw-r--r-- | gcc/config/i386/cygming.opt | 2 | ||||
-rw-r--r-- | gcc/config/i386/mingw-w64.h | 18 | ||||
-rw-r--r-- | gcc/config/i386/mingw-w64.opt | 2 | ||||
-rw-r--r-- | gcc/config/i386/mingw.opt | 8 | ||||
-rw-r--r-- | gcc/config/i386/mingw32.h | 18 | ||||
-rw-r--r-- | gcc/config/i386/t-cygming | 11 |
7 files changed, 60 insertions, 13 deletions
diff --git a/gcc/config.gcc b/gcc/config.gcc index 0d026e7..d40ad44d 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -1410,7 +1410,7 @@ i[34567]86-*-cygwin*) use_gcc_stdint=wrap ;; i[34567]86-*-mingw* | x86_64-*-mingw*) - tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h i386/cygming.h i386/mingw32.h" + tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h i386/cygming.h" xm_file=i386/xm-mingw32.h case ${target} in x86_64-*-* | *-w64-*) @@ -1420,6 +1420,10 @@ i[34567]86-*-mingw* | x86_64-*-mingw*) *) ;; esac + if test x$enable_threads = xposix ; then + tm_file="${tm_file} i386/mingw-pthread.h" + fi + tm_file="${tm_file} i386/mingw32.h" # This makes the logic if mingw's or the w64 feature set has to be used case ${target} in *-w64-*) @@ -1488,8 +1492,12 @@ i[34567]86-*-mingw* | x86_64-*-mingw*) use_gcc_stdint=wrap case ${enable_threads} in "" | yes | win32) thread_file='win32' - tmake_file="${tmake_file} i386/t-gthr-win32" - ;; + tmake_file="${tmake_file} i386/t-gthr-win32" + ;; + posix) + thread_file='posix' + tmake_file="i386/t-mingw-pthread ${tmake_file}" + ;; esac case ${target} in x86_64-*-mingw*) diff --git a/gcc/config/i386/cygming.opt b/gcc/config/i386/cygming.opt index 0fb325b..2d23523 100644 --- a/gcc/config/i386/cygming.opt +++ b/gcc/config/i386/cygming.opt @@ -52,3 +52,5 @@ Compile code that relies on Cygwin DLL wrappers to support C++ operator new/dele posix Driver + +; Retain blank line above diff --git a/gcc/config/i386/mingw-w64.h b/gcc/config/i386/mingw-w64.h index f84434a..62a72ef 100644 --- a/gcc/config/i386/mingw-w64.h +++ b/gcc/config/i386/mingw-w64.h @@ -1,8 +1,8 @@ /* Operating system specific defines to be used when targeting GCC for hosting on Windows 32/64 via mingw-w64 runtime, using GNU tools and the Windows API Library. - Copyright (C) 2009, - 2010 Free Software Foundation, Inc. + Copyright (C) 2009, 2010, + 2011 Free Software Foundation, Inc. This file is part of GCC. @@ -20,11 +20,13 @@ You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>. */ -/* Enable -municode feature. */ +/* Enable -municode feature and support optional pthread support. */ #undef CPP_SPEC -#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT} \ - %{municode:-DUNICODE}" +#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT} " \ + "%{municode:-DUNICODE} " \ + "%{" SPEC_PTHREAD1 ":-D_REENTRANCE} " \ + "%{" SPEC_PTHREAD2 ":-U_REENTRANCE} " #undef STARTFILE_SPEC #define STARTFILE_SPEC "%{shared|mdll:dllcrt2%O%s} \ @@ -38,6 +40,12 @@ along with GCC; see the file COPYING3. If not see #undef ASM_SPEC #define ASM_SPEC "%{m32:--32} %{m64:--64}" +#undef LIB_SPEC +#define LIB_SPEC "%{pg:-lgmon} %{" SPEC_PTHREAD1 ":-lpthread} " \ + "%{" SPEC_PTHREAD2 ": } " \ + "%{mwindows:-lgdi32 -lcomdlg32} " \ + "-ladvapi32 -lshell32 -luser32 -lkernel32" + #undef SPEC_32 #undef SPEC_64 #if TARGET_64BIT_DEFAULT diff --git a/gcc/config/i386/mingw-w64.opt b/gcc/config/i386/mingw-w64.opt index 965f4c0..4eebce6 100644 --- a/gcc/config/i386/mingw-w64.opt +++ b/gcc/config/i386/mingw-w64.opt @@ -21,3 +21,5 @@ municode Target Use unicode startup and define UNICODE macro + +; Retain blank line above. diff --git a/gcc/config/i386/mingw.opt b/gcc/config/i386/mingw.opt index bd9a4b6..f7ae189 100644 --- a/gcc/config/i386/mingw.opt +++ b/gcc/config/i386/mingw.opt @@ -18,6 +18,12 @@ ; along with GCC; see the file COPYING3. If not see ; <http://www.gnu.org/licenses/>. +pthread +Driver + +no-pthread +Driver + Wpedantic-ms-format C ObjC C++ ObjC++ Var(warn_pedantic_ms_format) Init(1) Warning Warn about none ISO msvcrt scanf/printf width extensions @@ -25,3 +31,5 @@ Warn about none ISO msvcrt scanf/printf width extensions fset-stack-executable Common Report Var(flag_setstackexecutable) Init(1) Optimization For nested functions on stack executable permission is set. + +; Need to retain blank line above. diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h index 7485b9d..fa55ce4 100644 --- a/gcc/config/i386/mingw32.h +++ b/gcc/config/i386/mingw32.h @@ -43,6 +43,14 @@ along with GCC; see the file COPYING3. If not see } \ 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" @@ -67,13 +75,17 @@ along with GCC; see the file COPYING3. If not see #define STANDARD_INCLUDE_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_REENTRANCE} " \ + "%{" 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} " \ + "-ladvapi32 -lshell32 -luser32 -lkernel32" /* Weak symbols do not get resolved if using a Windows dll import lib. Make the unwind registration references strong undefs. */ diff --git a/gcc/config/i386/t-cygming b/gcc/config/i386/t-cygming index ccae237..c4807a0 100644 --- a/gcc/config/i386/t-cygming +++ b/gcc/config/i386/t-cygming @@ -77,16 +77,23 @@ SHLIB_SLIBDIR_QUAL = @shlib_slibdir_qual@ ifndef SHLIB_DLLDIR $(error SHLIB_DLLDIR must be defined) endif +ifndef SHLIB_PTHREAD_CFLAG +SHLIB_PTHREAD_CFLAG = +endif +ifndef SHLIB_PTHREAD_LDFLAG +SHLIB_PTHREAD_LDFLAG = +endif SHLIB_LINK = $(LN_S) -f $(SHLIB_MAP) $(SHLIB_MAP).def && \ if [ ! -d $(SHLIB_DIR) ]; then \ mkdir $(SHLIB_DIR); \ else true; fi && \ - $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \ + $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(SHLIB_PTHREAD_CFLAG) \ + -shared -nodefaultlibs \ $(SHLIB_MAP).def \ -Wl,--out-implib,$(SHLIB_DIR)/$(SHLIB_IMPLIB).tmp \ -o $(SHLIB_DIR)/$(SHLIB_SONAME).tmp @multilib_flags@ \ - $(SHLIB_OBJS) $(SHLIB_LC) && \ + $(SHLIB_OBJS) ${SHLIB_PTHREAD_LDFLAG} $(SHLIB_LC) && \ if [ -f $(SHLIB_DIR)/$(SHLIB_SONAME) ]; then \ mv -f $(SHLIB_DIR)/$(SHLIB_SONAME) \ $(SHLIB_DIR)/$(SHLIB_SONAME).backup; \ |