[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: allextract and defaultextract with Solaris and GCC

From: Bob Friesenhahn
Subject: Re: allextract and defaultextract with Solaris and GCC
Date: Tue, 20 Jul 2004 22:47:13 -0500 (CDT)

I do see that one part of libtool is using

  ${wl}-z ${wl}defaultextract

but another is using

  -z defaultextract

Perhaps this fragment dates from before the C compiler was used to link.


On Wed, 21 Jul 2004, komiyama wrote:


I have a problem with linking using libtool

When libtool try to link shared library from convinient library, like,

/bin/bash ../libtool --mode=link gcc -g -O2 -o -lelf -lmylib subdir/ subdir2/

It invoke gcc as,

gcc -shared -Wl,-h -Wl, -o .libs/ -z allextract subdir/.libs/libfoo.a subdir2/.libs/libvar.a -z defaultextract -lelf -lmylib

The problem is gcc dropped "-z defaultextract". So in gcc internal, it called linker as,

/usr/local/gcc/2.95.3/lib/gcc-lib/sparc-sun-solaris2.7/2.95.3/collect2 -V -G -dy -z text -Y P,/usr/ccs/lib:/usr/lib -Qy -o .libs/ /usr/local/gcc/2.95.3/lib/gcc-lib/sparc-sun-solaris2.7/2.95.3/crti.o /usr/ccs/lib/values-Xa.o /usr/local/gcc/2.95.3/lib/gcc-lib/sparc-sun-solaris2.7/2.95.3/crtbegin.o -L/usr/local/gcc/2.95.3/lib/gcc-lib/sparc-sun-solaris2.7/2.95.3 -L/usr/ccs/bin -L/usr/ccs/lib -L/usr/local/gcc/2.95.3/lib -h -z allextract subdir/.libs/libfoo.a subdir2/.libs/libvar.a -lelf -lmylib -lgcc -lgcc /usr/local/gcc/2.95.3/lib/gcc-lib/sparc-sun-solaris2.7/2.95.3/crtend.o /usr/local/gcc/2.95.3/lib/gcc-lib/sparc-sun-solaris2.7/2.95.3/crtn.o

So linker try to link all symbol even specified with -l. So it cause symbol conflict when convinient library and library specified with -l has same symbol.

I think in GCC case, libtool need to apply -z options as,

... -Wl,-z -Wl,allextract subdir/.libs/libfoo.a subdirs2/.libs/libvar.a -Wl,-z -Wl,defaultextract ...

( whole_archive_flag_spec="-Wl,-z -Wl,allextract\$convenience -Wl,-z -Wl,defaultextract" )

O.S. : Solaris8 (Sparc)
GCC  : 2.95.3

   Takeo Komiyama
     Takeo Komiyama
    Voice : +81-22-377-9767 Fax : +81-22-377-9709

    Freescale semiconductor Inc.
    2-9-1 , Akedori, Izumiku, Sendai-shi, Miyagi-ken 981-3206
       Email :    address@hidden

Libtool mailing list

Bob Friesenhahn

reply via email to

[Prev in Thread] Current Thread [Next in Thread]