[Top][All Lists]

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

allextract and defaultextract with Solaris and GCC

From: komiyama
Subject: allextract and defaultextract with Solaris and GCC
Date: Wed, 21 Jul 2004 11:18:47 +0900
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031007


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 

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

reply via email to

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