This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
what are weak external symbols?
- From: Bahadir Balban <bahadir dot balban at gmail dot com>
- To: binutils at sources dot redhat dot com
- Date: Sat, 26 Mar 2005 21:46:45 +0000
- Subject: what are weak external symbols?
- Reply-to: Bahadir Balban <bahadir dot balban at gmail dot com>
Hi,
I'm reading the book "Linkers and Loaders" and weak external symbols
are not so clearly explained (for me at least).
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?
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?
I thought this question best fits the binutils list, sorry if I'm off-topic.
Many thanks,
Bahadir