public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <ian@airs.com>
To: Bahadir Balban <bahadir.balban@gmail.com>
Cc: binutils@sources.redhat.com
Subject: Re: what are weak external symbols?
Date: Mon, 28 Mar 2005 14:19:00 -0000	[thread overview]
Message-ID: <m3r7i0wmzp.fsf@gossamer.airs.com> (raw)
In-Reply-To: <7ac1e90c0503261346244d052f@mail.gmail.com>

Bahadir Balban <bahadir.balban@gmail.com> writes:

> In summary it says that weak external symbols is a concept to avoid
> linking with unused parts of a library. The printf example is given:
> floating-point routines (namely fcvt) are referred as weak references
> by printf, such that when printf is used in a routine that didn't use
> fcvt, reference to fcvt resolves to zero and no error is produced from
> this.
> 
> Now the questions:
> 
> 1) Is my summary above correct?

Pretty much.  Instead of "a routine that didn't use fcvt" I would say
"a program that didn't use fcvt."

> 2) Is this a case such that, these fcvt routines are explicitly
> defined in printf as weak references? If so, how do you define it as
> such in C source? Or perhaps you use a linker flag when you create the
> library?

Search for weak here:
    http://gcc.gnu.org/onlinedocs/gcc-3.4.3/gcc/Function-Attributes.html#Function-Attributes

Other compilers have other mechanisms.

Ian

      reply	other threads:[~2005-03-28  1:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-28  2:08 Bahadir Balban
2005-03-28 14:19 ` Ian Lance Taylor [this message]

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=m3r7i0wmzp.fsf@gossamer.airs.com \
    --to=ian@airs.com \
    --cc=bahadir.balban@gmail.com \
    --cc=binutils@sources.redhat.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).