This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH: Support the FreeBSD 5.0 system thread library model


With version 5, API change 16, FreeBSD has improved how the system
thread libraries are handled to be in line with other POSIX platforms
(i.e. they must now be provided in addition to, not in place of, -lc).

John Polstra authored the new LIB_SPEC, which has been in use in the
FreeBSD 5.0 system compiler since 2001/01/25.  I added the logic to
key off the precise API change point; tested both paths (by visual
inspection of the resultant specs file and the usual more extensive
bootstrap and check cycle with no regressions seen); and checked that
the included header is known to exist on all versions of FreeBSD that
have ever used ELF (which are the only configurations that use
config/freebsd.h).  Pre-approved by David O'Brien (although we didn't
discuss this exact keying logic), primary gcc maintainer for freebsd.

Fully bootstrapped 3.0 branch (gcc_ss_20010507 with the patch):

i386-*-freebsd4.3
i386-*-freebsd5.0
alpha-*-freebsd5.0

Fully bootstrapped 3.0 branch (current with the patch):

i386-*-freebsd4.2
alpha-*-freebsd4.2

Fully bootstrapped current mainline with this one patch and unrelated
patches:

i386-*-freebsd4.2

With that, I think my ducks are in order on this very straightforward
port configuration patch which is confined to one platform's
configuration file.  I would like approval to apply on both the
mainline and the 3.0 branch.  gcc 2.95.3 with few patches is the
system compiler on FreeBSD 5.0 thus it would seem to be a regression
if gcc 3.0 didn't work there.

Granted, the API was changed on us and that might break the contract
thus I will respect the release manager's statement on the matter.
But I do hope the amount of effort I put into testing various
configurations will count for something and that we should not
penalize a platform that is attempting to look more like other POSIX
platforms.

Regards,
Loren

2001-05-11  Loren J. Rittle  <ljrittle@acm.org>

	* config/freebsd.h (LIB_SPEC): Add logic to select the correct
	setting and add new setting for FreeBSD 5.0 post API change 16
	from John Polstra.

Index: config/freebsd.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/freebsd.h,v
retrieving revision 1.6
diff -c -r1.6 freebsd.h
*** freebsd.h	2001/04/16 18:30:34	1.6
--- freebsd.h	2001/05/11 05:41:23
***************
*** 56,66 ****
    %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__}		\
    %{posix:-D_POSIX_SOURCE}"
  
! /* Provide a LIB_SPEC appropriate for FreeBSD.  Just select the appropriate
!    libc, depending on whether we're doing profiling or need threads support.
!    (simular to the default, except no -lg, and no -p).  */
  
  #undef  LIB_SPEC
  #define LIB_SPEC "							\
    %{!shared:								\
      %{!pg:								\
--- 56,77 ----
    %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__}		\
    %{posix:-D_POSIX_SOURCE}"
  
! /* Provide a LIB_SPEC appropriate for FreeBSD.  Before
!    __FreeBSD_version 500016, select the appropriate libc, depending on
!    whether we're doing profiling or need threads support.  (similar to
!    the default, except no -lg, and no -p).  At __FreeBSD_version
!    500016 and later, when threads support is requested include both
!    -lc and -lc_r instead of only -lc_r.  */
  
  #undef  LIB_SPEC
+ #include <osreldate.h>
+ #if __FreeBSD_version >= 500016
+ #define LIB_SPEC "                                                      \
+   %{!shared:                                                            \
+     %{!pg: %{pthread:-lc_r} -lc}                                        \
+     %{pg:  %{pthread:-lc_r_p} -lc_p}                                    \
+   }"
+ #else
  #define LIB_SPEC "							\
    %{!shared:								\
      %{!pg:								\
***************
*** 70,75 ****
--- 81,87 ----
        %{!pthread:-lc_p}							\
        %{pthread:-lc_r_p}}						\
    }"
+ #endif
  
  
  /* Code generation parameters.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]