delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/11/19/05:43:35

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <718D38CAB6E0D011B2C90060970C28A57E1AB7@exchangeserver.pixelpower.com>
From: David Korn <dkorn AT pixelpower DOT com>
To: "'Mohammad Saleem'" <mosa AT enea DOT se>, crossgcc AT sources DOT redhat DOT com,
cygwin AT cygwin DOT com
Subject: RE: linking application with a library
Date: Mon, 19 Nov 2001 10:46:25 -0000
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2650.21)

>-----Original Message-----
>From: Mohammad Saleem [mailto:mosa AT enea DOT se]
>Sent: 18 November 2001 10:36


>I have a lib mylib.a (20 kb) which I want to link with my application.
>My application gets 20 kb bigger as soon as I link it with mylib.a 
>without any function being called from mylib.a.
>It seems to me that I have built mylib.a so that the whole lib 
>is linked 
>during linking process even if no one method is being called.
>Now my question is which flag should I use to build mylib.a so 
>that only 
>those functions are linked which are being called.
>If no function is called then linking mylib.a shouldn't affect 
>the size 
>of my application.

  Alas, the linker is fairly dumb, and can only include or exclude parts
of a lib file on the basis of the section name (.text, .data or .bss).

  Fortunately the compiler is fairly smart, and has an option
-ffunction-sections that puts every function in a different section.  This
should supposedly do the job you wish.

      DaveK
-- 
Burn your ID card!  http://www.optional-identity.org.uk/
Help support the campaign, copy this into your .sig!


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019