Removing -pthread from gcc

Daniel Eischen eischen at vigrid.com
Thu Aug 28 17:12:59 PDT 2003


Attached is a patch to remove -pthread from gcc.  It's been
deprecated for 2.5 years and it should finally be put to rest.
Also, it will cause us problems now with multiple thread
libraries from which to choose.

The only problem is that the patch would take config.gcc
off the vendor branch.  I'm not sure how else to fix it.

I've built world with these patches.  I haven't built any
ports, though I expect many to break.  But it's got to
happen sometime, and we've waited too long already.  Here
is a link to some email over 2 years ago:

  http://docs.freebsd.org/cgi/getmsg.cgi?fetch=641401+0+archive/2001/freebsd-current/20010218.freebsd-current

-- 
Dan Eischen
-------------- next part --------------
Index: config.gcc
===================================================================
RCS file: /opt/FreeBSD/cvs/src/contrib/gcc/config.gcc,v
retrieving revision 1.1.1.7
diff -u -r1.1.1.7 config.gcc
--- config.gcc	11 Jul 2003 03:40:48 -0000	1.1.1.7
+++ config.gcc	28 Aug 2003 16:50:29 -0000
@@ -484,11 +484,11 @@
 	xno) fbsd_tm_file="${fbsd_tm_file} freebsd-nthr.h";;
 	x | xyes | xpthreads | xposix)
 		thread_file='posix'
-		tmake_file="${tmake_file} t-freebsd-thread"
 		# Before 5.0, FreeBSD can't bind shared libraries to -lc
 		# when "optionally" threaded via weak pthread_* checks.
 		case $machine in
 		*-*-freebsd[34] | *-*-freebsd[34].*)
+			tmake_file="${tmake_file} t-freebsd-thread"
 			tmake_file="${tmake_file} t-slibgcc-nolc-override";;
 		esac
 		;;
Index: config/freebsd-spec.h
===================================================================
RCS file: /opt/FreeBSD/cvs/src/contrib/gcc/config/freebsd-spec.h,v
retrieving revision 1.9
diff -u -r1.9 freebsd-spec.h
--- config/freebsd-spec.h	24 Aug 2003 16:56:31 -0000	1.9
+++ config/freebsd-spec.h	28 Aug 2003 17:14:08 -0000
@@ -127,49 +127,13 @@
   %{shared:crtendS.o%s} \
   crtn.o%s "
 
-/* Provide a LIB_SPEC appropriate for FreeBSD as configured and as
-   required by the user-land thread model.  Before __FreeBSD_version
-   500016, select the appropriate libc, depending on whether we're
-   doing profiling or need threads support.  At __FreeBSD_version
-   500016 and later, when threads support is requested include both
-   -lc and -lc_r instead of only -lc_r.  To make matters interesting,
-   we can't actually use __FreeBSD_version provided by <osreldate.h>
-   directly since it breaks cross-compiling.  As a final twist, make
-   it a hard error if -pthread is provided on the command line and gcc
-   was configured with --disable-threads (this will help avoid bug
-   reports from users complaining about threading when they
-   misconfigured the gcc bootstrap but are later consulting FreeBSD
-   manual pages that refer to the mythical -pthread option).  */
-
 /* Provide a LIB_SPEC appropriate for FreeBSD.  Just select the appropriate
-   libc, depending on whether we're doing profiling or need threads support.
+   libc, depending on whether we're doing profiling or not.
    (simular to the default, except no -lg, and no -p).  */
 
-#ifdef FBSD_NO_THREADS
 #define FBSD_LIB_SPEC "							\
-  %{pthread: %eThe -pthread option is only supported on FreeBSD when gcc \
-is built with the --enable-threads configure-time option.}		\
+  %{pthread: %eThe -pthread option is deprecated.}			\
   %{!shared:								\
     %{!pg: -lc}								\
     %{pg:  -lc_p}							\
   }"
-#else
-#include <sys/param.h>
-#if __FreeBSD_version >= 500016
-#define FBSD_LIB_SPEC "							\
-  %{!shared:								\
-    %{!pg: %{pthread:-lc_r} -lc}					\
-    %{pg:  %{pthread:-lc_r_p} -lc_p}					\
-  }"
-#else
-#define FBSD_LIB_SPEC "							\
-  %{!shared:								\
-    %{!pg:								\
-      %{!pthread:-lc}							\
-      %{pthread:-lc_r}}							\
-    %{pg:								\
-      %{!pthread:-lc_p}							\
-      %{pthread:-lc_r_p}}						\
-  }"
-#endif
-#endif


More information about the freebsd-threads mailing list