This is the mail archive of the mailing list for the Cygwin 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]

Re[3]: ld ---export--all --exclude-libs,?

 --- Corinna Vinschen <> wrote: > On Wed, Nov 21, 2001
at 12:45:08PM -0500, Charles Wilson wrote:
> > Corinna Vinschen wrote:
> > > Isn't the functionality you're searching for already in ld given by
> > > the --no-whole-archive options?
> > > 
> > >   gcc -shared -o cygfoo.dll $(OBJ)
> > >       -Wl,--out-implib,libfoo.dll.a
> > >       -Wl,--no-whole-archive -lbar -lbaz
> > > 
> > > Or am I missing the point?
> > 
> > 
> > the problem is, --no-whole-archive applies to EVERY library, even 
> > convenience libraries.  For instance, a common autotools idiom is to 
> > create various convenience libraries libsubunit1.a and libsubunit2.a. 
> > These archives are intended to be included in the eventual .so (.dll) 
> > and the internal symbols of libsubunit*.a are INTENDED to be exported 
> > from that .so.
> > 
> > --no-whole-archive makes this idiom impossible; it is not granular 
> > enough.  Ralf's solution removes the whole purpose of the idiom -- 
> > what's the use of a "convenience" library if you use --no-whole-archive
> > and must then explicitly export every .o contained within the 
> > "convenience" library?  You're better off not creating the
> "convenience" 
> > library at all, and just explicitly adding the various .o files to your
> > link command line.
> But isn't that the purpose of --whole-archive?  In the above
> example I can create the static libs libfoo1.a and libfoo2.a
> from $(OBJ) and then call
> 	gcc -shared -o cygfoo.dll
> 	    -Wl,--out-implib,libfoo.dll.a
> 	    -Wl,--whole-archive libfoo1.a libfoo2.a
> 	    -Wl,--no-whole-archive -lbar -lbaz
> Corinna

Still, those symbols from static libbar.a and libbaz.a that are used by
cygfoo will be exported from cygfoo.dll. That can cause problems if another
dll or exe that depends on cygfoo.dll also needs code from static libbar.a
or libfoo.a.  Thats  the reason why the current pe-dll.c has default
exclude libs.  The --exclude-libs option would fix more generally.

Danny - Yahoo! Shopping
- Get organised for Christmas early this year!

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