Mailing-List: contact cygwin-apps-help AT sourceware DOT cygnus DOT com; run by ezmlm Sender: cygwin-apps-owner AT sourceware DOT cygnus DOT com List-Subscribe: List-Archive: List-Post: List-Help: , Delivered-To: mailing list cygwin-apps AT sources DOT redhat DOT com Message-ID: <20011121233759.38352.qmail@web14507.mail.yahoo.com> Date: Thu, 22 Nov 2001 10:37:59 +1100 (EST) From: =?iso-8859-1?q?Danny=20Smith?= Subject: Re[3]: ld ---export--all --exclude-libs,? To: cygwin-apps AT cygwin DOT com In-Reply-To: <20011122002107.C27931@cygbert.vinschen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit --- 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 Danny http://shopping.yahoo.com.au - Yahoo! Shopping - Get organised for Christmas early this year!