From: Steve Graegert <graegerts@gmail.com>
To: linux-c-programming@vger.kernel.org
Subject: Re: Does GCC link only used functions?
Date: Sun, 29 Jan 2006 17:23:44 +0100 [thread overview]
Message-ID: <6a00c8d50601290823g6f13fcdcw84f193881d735e4d@mail.gmail.com> (raw)
In-Reply-To: <200601291438.17093.samjnaa@gmail.com>
On 1/29/06, Shriramana Sharma <samjnaa@gmail.com> wrote:
> Hello list. I am relative newbie to GCC.
>
> I have a C program which #includes a header file which in turn #includes many
> other header files. These header files are part of an open source library set
> I got from the net.
>
> Now I do not use all the functions in the various libraries, but the makefile
> which came with the library of course has compile instructions for all the
> libraries. I have modified the makefile to compile my program using those
> libraries, but I did not remove the references to the libraries I knew I did
> not use, for I feared that some error may be caused.
>
> But later I experimented removing some of the superfluous ones from the
> makefile and again "make"-d, and I got the same size executable as before.
>
> So does this mean that GCC links only those functions from a library which I
> call directly or indirectly through another called function in the course of
> my program?
Yes, everything not needed for program execution is simply dropped in
the stage of linking.
\Steve
--
Steve Graegert <graegerts@gmail.com>
Software Consultant {C/C++ && Java && .NET}
Office: +49 9131 7123988
Mobile: +49 1520 9289212
next prev parent reply other threads:[~2006-01-29 16:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-29 9:08 Does GCC link only used functions? Shriramana Sharma
2006-01-29 16:23 ` Steve Graegert [this message]
2006-01-29 18:17 ` Glynn Clements
2006-02-02 5:17 ` Hendrik Visage
2006-02-02 16:39 ` Glynn Clements
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6a00c8d50601290823g6f13fcdcw84f193881d735e4d@mail.gmail.com \
--to=graegerts@gmail.com \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).