[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Don't discard -lgcc from `-lgcc -c -lgcc'
From: |
Alexandre Oliva |
Subject: |
Don't discard -lgcc from `-lgcc -c -lgcc' |
Date: |
09 Apr 2001 15:27:13 -0300 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.1 (Cuyahoga Valley) |
I've finally figured out why our duplicate-elimination is not as
outrageous as I had thought at first. Marking libraries as
specialdeplibs is indeed a neat heuristics; see the comments in the
patch below. Unfortunately, it doesn't catch the common case of the
libraries implicitly linked in by GCC, which affects our ability to
create correct C++ shared libraries with g++. Fixed as follows. Ok
to install?
Index: ChangeLog
from Alexandre Oliva <address@hidden>
* ltmain.in: Mark duplicate libraries appearing in predeps and
postdeps as specialdeplibs. Explain the whole plan.
Index: ltmain.in
===================================================================
RCS file: /cvsroot/libtool/libtool/ltmain.in,v
retrieving revision 1.200.2.60
diff -u -p -r1.200.2.60 ltmain.in
--- ltmain.in 2001/04/08 10:03:52 1.200.2.60
+++ ltmain.in 2001/04/09 18:22:33
@@ -1630,6 +1630,18 @@ EOF
if test $linkmode = lib; then
libs="$predeps $libs $compiler_lib_search_path $postdeps"
+
+ # Compute libraries that are listed more than once in $predeps
+ # $postdeps and mark them as special (i.e., whose duplicates are
+ # not to be eliminated).
+ pre_post_deps=
+ for pre_post_dep in $predeps $postdeps; do
+ case "$pre_post_deps " in
+ *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
+ esac
+ pre_post_deps="$pre_post_deps $pre_post_dep"
+ done
+ pre_post_deps=
fi
deplibs=
@@ -2373,6 +2385,20 @@ EOF
case $deplib in
-L*) new_libs="$deplib $new_libs" ;;
*)
+ # And here is the reason: when a library appears more
+ # than once as an explicit dependence of a library, or
+ # is implicitly linked in more than once by the
+ # compiler, it is considered special, and multiple
+ # occurrences thereof are not removed. Compare this
+ # with having the same library being listed as a
+ # dependency of multiple other libraries: in this case,
+ # we know (pedantically, we assume) the library does not
+ # need to be listed more than once, so we keep only the
+ # last copy. This is not always right, but it is rare
+ # enough that we require users that really mean to play
+ # such unportable linking tricks to link the library
+ # using -Wl,-lname, so that libtool does not consider it
+ # for duplicate removal.
case " $specialdeplibs " in
*" $deplib "*) new_libs="$deplib $new_libs" ;;
*)
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer address@hidden, redhat.com}
CS PhD student at IC-Unicamp address@hidden, gnu.org}
Free Software Evangelist *Please* write to mailing lists, not to me
- Don't discard -lgcc from `-lgcc -c -lgcc',
Alexandre Oliva <=