This is the mail archive of the libstdc++@sources.redhat.com mailing list for the libstdc++ project.


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

Re: Adding _eh.o frame-dwarf2.o to libstdc++.so.3?


On Tue, Jul 25, 2000 at 05:17:38PM -0700, Benjamin Kosnik wrote:
> 
> H.J:
> 
> As you undoubtebly know, this change completely hosed shared libstdc++'s:
> 
> 
> You've noticed this yourself:
> 
> http://gcc.gnu.org/ml/gcc/2000-07/msg00007.html
> http://gcc.gnu.org/ml/gcc/2000-07/msg00009.html

Yes. Welcome to the club :-).

> 
> It's been broken almost a month now. Any libstdc++-v3 testcases that
> throw standard exceptions core unless I add _eh.o and frame-dwarf2.o
> to the shared library.
> 
> This is pretty lame..... anyway.
> 
> I looked through the last two months of postings from you, and see
> some stuff about libtool work which I suspect may actually solve the
> problem... does it?

Yes, it does for me.

> 
> http://gcc.gnu.org/ml/gcc/2000-07/msg00568.html
> http://gcc.gnu.org/ml/gcc-patches/2000-07/msg00707.html
> 

Here is my updated version for gcc. It should be very close to the
one checked into libtool CVS by Alexandre. Alexandre, I thought you
were going into checking your vesion into gcc also. What happened?


H.J.
----
2000-07-18  H.J. Lu  (hjl@gnu.org)

	* ltmain.sh: Add -lc when building shared libary only if
	necessary.

	* ltconfig: Check if -lc is necessary for building shared
	libary. Set build_libtool_need_lc to indicate it.

Index: ltconfig
===================================================================
RCS file: /work/cvs/gnu/egcs/ltconfig,v
retrieving revision 1.1.1.5
diff -u -p -r1.1.1.5 ltconfig
--- ltconfig	2000/07/24 21:05:50	1.1.1.5
+++ ltconfig	2000/07/26 00:30:03
@@ -2199,6 +2199,51 @@ esac
 
 echo "$ac_t$enable_shared" 1>&6
 
+need_lc=yes
+if test "$enable_shared" = yes && test "$with_gcc" = yes; then
+  case "$archive_cmds" in
+  *'~'*)
+    # FIXME: we may have to deal with multi-command sequences.
+    ;;
+  '$CC '*)
+    # Test whether the compiler implicitly links with -lc since on some
+    # systems, -lgcc has to come before -lc. If gcc already passes -lc
+    # to ld, don't add -lc before -lgcc.
+    echo $ac_n "checking if we need -lc for building shared libraries... $ac_c" 1>&6
+    if eval "test \"`echo '$''{'ac_cv_archive_cmds_needs_lc'+set}'`\" = set"; then
+      echo $ac_n "(cached) $ac_c" 1>&6
+      need_lc=$ac_cv_archive_cmds_needs_lc
+    else
+      $rm conftest*
+      echo "static int dummy;" > conftest.c
+      if { (eval echo $progname:2219: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then
+	# Append any warnings to the config.log.
+	cat conftest.err 1>&5
+
+	soname=conftest
+	lib=conftest
+	libobjs=conftest.o
+	deplibs=
+	linkopts=-v
+	compiler_flags=-v
+	linker_flags=-v
+	verstring=
+	output_objdir=.
+	libname=conftest
+	allow_undefined_flag=
+	if { (eval echo $progname:2234: \"$archive_cmds\") 1>&5; (eval $archive_cmds) 2>&1 | grep " -lc " 1>&5 ; }; then
+	  need_lc=no
+	fi
+      else
+	cat conftest.err 1>&5
+      fi
+    fi
+    echo "$ac_t$need_lc" 1>&6
+    ;;
+  esac
+fi
+ac_cv_archive_cmds_needs_lc=$need_lc
+
 # Make sure either enable_shared or enable_static is yes.
 test "$enable_shared" = yes || enable_static=yes
 
@@ -2803,6 +2848,9 @@ SHELL=$LTSHELL
 
 # Whether or not to build shared libraries.
 build_libtool_libs=$enable_shared
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$need_lc
 
 # Whether or not to build static libraries.
 build_old_libs=$enable_static
Index: ltmain.sh
===================================================================
RCS file: /work/cvs/gnu/egcs/ltmain.sh,v
retrieving revision 1.1.1.5
diff -u -p -r1.1.1.5 ltmain.sh
--- ltmain.sh	2000/07/24 21:05:50	1.1.1.5
+++ ltmain.sh	2000/07/24 22:16:37
@@ -1816,8 +1816,10 @@ compiler."
 	  # these systems don't actually have a c library (as such)!
 	  ;;
 	*)
-	  # Add libc to deplibs on all other systems.
-	  deplibs="$deplibs -lc"
+	  # Add libc to deplibs on all other systems if necessary.
+	  if test $build_libtool_need_lc = "yes"; then
+	    deplibs="$deplibs -lc"
+	  fi
 	  ;;
 	esac
       fi

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