diff mbox

cygwin: accept -pthread

Message ID 53ED8C48.8000805@redhat.com
State New
Headers show

Commit Message

Yaakov Selkowitz Aug. 15, 2014, 4:27 a.m. UTC
The attached patch enables the -pthread flag for cygwin targets.  While 
not strictly necessary for compiling or linking with pthread or _r 
functions on Cygwin, accepting it allows for better compatibility with 
other platforms.

Comments

Kai Tietz Aug. 19, 2014, 3:28 p.m. UTC | #1
Patch is ok. Applied this patch at revision 214161 together with your
followup-patch at revision 214162.

Thanks,
Kai
diff mbox

Patch

Index: gcc/config.gcc
===================================================================
--- gcc/config.gcc	(revision 213759)
+++ gcc/config.gcc	(working copy)
@@ -1568,7 +1568,7 @@ 
 	xm_file=i386/xm-cygwin.h
 	tmake_file="${tmake_file} i386/t-cygming t-slibgcc"
 	target_gtfiles="\$(srcdir)/config/i386/winnt.c"
-	extra_options="${extra_options} i386/cygming.opt"
+	extra_options="${extra_options} i386/cygming.opt i386/cygwin.opt"
 	extra_objs="winnt.o winnt-stubs.o"
 	c_target_objs="${c_target_objs} msformat-c.o"
 	cxx_target_objs="${cxx_target_objs} winnt-cxx.o msformat-c.o"
@@ -1584,7 +1584,7 @@ 
 	xm_file=i386/xm-cygwin.h
 	tmake_file="${tmake_file} i386/t-cygming t-slibgcc i386/t-cygwin-w64"
 	target_gtfiles="\$(srcdir)/config/i386/winnt.c"
-	extra_options="${extra_options} i386/cygming.opt"
+	extra_options="${extra_options} i386/cygming.opt i386/cygwin.opt"
 	extra_objs="winnt.o winnt-stubs.o"
 	c_target_objs="${c_target_objs} msformat-c.o"
 	cxx_target_objs="${cxx_target_objs} winnt-cxx.o msformat-c.o"
Index: gcc/config/i386/cygwin.h
===================================================================
--- gcc/config/i386/cygwin.h	(revision 213759)
+++ gcc/config/i386/cygwin.h	(working copy)
@@ -32,6 +32,7 @@ 
 #undef CPP_SPEC
 #define CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} \
   %{!ansi:-Dunix} \
+  %{pthread:-D_REENTRANT} \
   %{mwin32:-DWIN32 -D_WIN32 -D__WIN32 -D__WIN32__ %{!ansi:-DWINNT}} \
   %{!nostdinc:%{!mno-win32:-idirafter ../include/w32api%s -idirafter ../../include/w32api%s}}\
 "
@@ -77,6 +77,7 @@ 
 #undef LIB_SPEC
 #define LIB_SPEC "\
   %{pg:-lgmon} \
+  %{pthread: } \
   -lcygwin \
   %{mwindows:-lgdi32 -lcomdlg32} \
   -ladvapi32 -lshell32 -luser32 -lkernel32"
@@ -129,7 +131,7 @@ 
 
 /* Every program on cygwin links against cygwin1.dll which contains 
    the pthread routines.  There is no need to explicitly link them
-   and the -pthread flag is not recognized.  */
+   and the -pthread flag is accepted only for compatibility.  */
 #undef GOMP_SELF_SPECS
 #define GOMP_SELF_SPECS ""
 #undef GTM_SELF_SPECS
Index: gcc/config/i386/cygwin.opt
===================================================================
--- gcc/config/i386/cygwin.opt	(revision 0)
+++ gcc/config/i386/cygwin.opt	(working copy)
@@ -0,0 +1,24 @@ 
+; Cygwin-specific options.
+
+; Copyright (C) 2013-2014 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 3, or (at your option) any later
+; version.
+;
+; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+; WARRANTY; without even the implied warranty of 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 COPYING3.  If not see
+; <http://www.gnu.org/licenses/>.
+
+pthread
+Driver
+
+; Retain blank line above