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]
Other format: [Raw text]

(mainline and 3.1) PATCH: Enable shared libgcc on *-*-freebsd[3-]*


Functionally, I have had this patch in my mainline tree for a long
while (before 3.1 branched).  The configuration change was either
fully bootstrapped or rebuilt in an already bootstrapped tree and
checked on mainline against i386-*-freebsd4.5 (also checked in 3.1),
i386-*-freebsd5.0, alpha-*-freebsd4.2 (also checked in 3.1) and
alpha-*-freebsd5.0 (only checked 3.1) (none of which had shared libgcc
installed by default; all of which use gcc by default).  This exact
patch of the config logic was tested on i386-*-freebsd4.5 (fully
bootstrapped 3.1).  No regressions.  The test suite itself does not
expose the EH issues involving multiple shared libraries, etc.

This long-due patch allows library symbol hiding and versioning in
libstdc++-v3 (recently enabled) and should remove situations where EH
failures occur in real programs linked against multiple shared
libraries on this platform.  Under FreeBSD [34] only, I have handled
the issue where FreeBSD before 5.0 may not always construct a shared
library directly against -lc.

If this patch is not acceptable, then I will submit a version that
adds t-slibgcc-elf-ver to tmake_file only for *-*-freebsd[5-]*.
However, IMHO, FreeBSD 4 will be in wide use for some time to come.

Permission to apply as is?  David, I would like your approval as well
since this is a fundamental port configuration change.  I remember
that you have raised the issue of building shared C++ libraries with a
non-system gcc and I belive this patch partly or fully eliminates
those past concerns.

	* config.gcc (*-*-freebsd*): Enable creation of libgcc_s.so.
	* config/t-slibgcc-elf-ver (SHLIB_LC): Add macro and use it.
	No functional change except ...
	* config/t-slibgcc-nolc-override (SHLIB_LC): Override it.
	* doc/install.texi (*-*-freebsd*): Document port configuration.

Index: gcc/config.gcc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config.gcc,v
retrieving revision 1.173
diff -c -r1.173 config.gcc
*** config.gcc	2002/03/27 02:24:28	1.173
--- config.gcc	2002/03/28 06:26:49
***************
*** 363,369 ****
  	*-*-freebsd6 | *-*-freebsd[6].*) fbsd_tm_file="freebsd6.h";;
  	*) echo 'Please update *-*-freebsd* in gcc/config.gcc'; exit 1;;
  	esac
! 	tmake_file=t-freebsd
  	xmake_file=none
  	xm_defines=POSIX
  	case x${enable_threads} in
--- 363,369 ----
  	*-*-freebsd6 | *-*-freebsd[6].*) fbsd_tm_file="freebsd6.h";;
  	*) echo 'Please update *-*-freebsd* in gcc/config.gcc'; exit 1;;
  	esac
! 	tmake_file="t-slibgcc-elf-ver t-freebsd"
  	xmake_file=none
  	xm_defines=POSIX
  	case x${enable_threads} in
***************
*** 371,376 ****
--- 371,382 ----
  	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-slibgcc-nolc-override";;
+ 		esac
  		;;
  	*) echo 'Unknown thread configuration for FreeBSD'; exit 1;;
  	esac
Index: gcc/config/t-slibgcc-elf-ver
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/t-slibgcc-elf-ver,v
retrieving revision 1.2
diff -c -r1.2 t-slibgcc-elf-ver
*** t-slibgcc-elf-ver	2001/06/13 14:26:02	1.2
--- t-slibgcc-elf-ver	2002/03/28 06:26:49
***************
*** 6,16 ****
  SHLIB_SONAME = @shlib_base_name@.so.1
  SHLIB_MAP = @shlib_map_file@
  SHLIB_OBJS = @shlib_objs@
  
  SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
  	-Wl,--soname=$(SHLIB_SONAME) \
  	-Wl,--version-script=$(SHLIB_MAP) \
! 	-o $(SHLIB_NAME) @multilib_flags@ $(SHLIB_OBJS) -lc && \
  	rm -f $(SHLIB_SONAME) && \
  	$(LN_S) $(SHLIB_NAME) $(SHLIB_SONAME)
  # $(slibdir) double quoted to protect it from expansion while building
--- 6,17 ----
  SHLIB_SONAME = @shlib_base_name@.so.1
  SHLIB_MAP = @shlib_map_file@
  SHLIB_OBJS = @shlib_objs@
+ SHLIB_LC = -lc
  
  SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
  	-Wl,--soname=$(SHLIB_SONAME) \
  	-Wl,--version-script=$(SHLIB_MAP) \
! 	-o $(SHLIB_NAME) @multilib_flags@ $(SHLIB_OBJS) $(SHLIB_LC) && \
  	rm -f $(SHLIB_SONAME) && \
  	$(LN_S) $(SHLIB_NAME) $(SHLIB_SONAME)
  # $(slibdir) double quoted to protect it from expansion while building
*** /dev/null	Thu Mar 28 00:25:52 2002
--- gcc/config/t-slibgcc-nolc-override	Wed Mar 27 21:20:32 2002
***************
*** 0 ****
--- 1 ----
+ SHLIB_LC =
Index: gcc/doc/install.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/install.texi,v
retrieving revision 1.95
diff -c -r1.95 install.texi
*** install.texi	2002/03/27 22:52:00	1.95
--- install.texi	2002/03/28 07:14:02
***************
*** 2079,2084 ****
--- 2079,2086 ----
  supported by FreeBSD will require additional configuration tuning in, at
  the very least, both boehm-gc and libffi.
  
+ Shared @file{libgcc_s.so} is now built and installed by default.
+ 
  @html
  </p>
  <hr>


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