cvs commit: src/contrib/gcc/config freebsd-spec.h

Daniel Eischen eischen at vigrid.com
Mon Sep 1 13:21:24 PDT 2003


On Mon, 1 Sep 2003, David O'Brien wrote:

> On Mon, Sep 01, 2003 at 02:08:58AM -0400, Daniel Eischen wrote:
> > > > > Please back this out.
> 
> Thank you for backing this out.

... just playing by the rules :-)

> > > For one, don't forget people use the GCC ports and the stock sources from
> > > the FSF -- we don't need the system compiler to be the old man out.  If
> > > you really want to de-support "-pthread" there are two ways to go about
> > > it.  (1) starting with some GCC version, (2) starting with targeting a
> > > particular FreeBSD version.  For instance we could either say that GCC
> > > 3.4 does not accept "-pthread" for any FreeBSD target.  Or we could say
> > > that GCC targeting RELENG_5 does not accept "-pthread".  It should be
> > > clear which is being chosen and the repercussions.
> > 
> > RELENG_5 should not support it.  We need to get rid of
> > it ASAP so we can work on getting our ports free of it
> > and making them work with other thread libraries.
> > 
> > How do we accomplish this quickly?
> 
> Sounds like you want a policy that:
> 
>     "-pthread" should not be supported when targeting FreeBSD 5.{2-9}
>     using FSF GCC 3.3.2 (and 3.3.1 in /usr/src).

Sounds right.

> You would also like to not support "-pthread" when targeting FreeBSD 4.x.
> I'm not convinced that we really can remove it there.  Also that will
> make FSF GCC 3.3.2 not accept the same options that the system FreeBSD
> 4.x compiler does.  Can we live with tolerating "-pthread" when targeting
> FreeBSD 4.x by any version of FSF GCC?

Hmm, you mean cross-compiling.  I guess, if you're cross-compiling
and still need to provide -pthread-like behavior, you can still do
it with -nostdlib -lc_r etc.

> If so, an acceptable diff would be to only change the FBSD_LIB_SPEC w/in
> the "#if __FreeBSD_version >= 500016" block.  Turning "-pthread" into a
> NOP + warning would be nice, but the error output code you replaced the
> entire FBSD_LIB_SPEC with would be OK too I guess.  The comment
> addressing "At __FreeBSD_version 500016 and later,..." should be updated.
> Can you commit such a change?  I'll get it into the right FSF GCC
> person's hands for GCC 3.3.2.

Yes, see attached patch for review.  I'll won't commit it until you've
reviewed it.

Thanks for taking the time to work with me on this.

-- 
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.11
diff -u -r1.11 freebsd-spec.h
--- config/freebsd-spec.h	1 Sep 2003 05:31:33 -0000	1.11
+++ config/freebsd-spec.h	1 Sep 2003 19:45:21 -0000
@@ -131,15 +131,17 @@
    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).  */
+   500016 and later, threads libraries can be linked with libc.
+   Because of this, and because different (not multiple) threading
+   libraries may be selected in the link option, the -pthread option
+   is no longer supported.  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.
@@ -157,9 +159,10 @@
 #include <sys/param.h>
 #if __FreeBSD_version >= 500016
 #define FBSD_LIB_SPEC "							\
+  %{pthread: %eThe -pthread option is deprecated.}			\
   %{!shared:								\
-    %{!pg: %{pthread:-lc_r} -lc}					\
-    %{pg:  %{pthread:-lc_r_p} -lc_p}					\
+    %{!pg: -lc}								\
+    %{pg: -lc_p}							\
   }"
 #else
 #define FBSD_LIB_SPEC "							\


More information about the cvs-src mailing list