M. Warner Losh
imp at bsdimp.com
Mon Apr 21 12:02:26 UTC 2008
In message: <20080421070050.GA13685 at owl.midgard.homeip.net>
Erik Trulsson <ertr1013 at student.uu.se> writes:
: On Sun, Apr 20, 2008 at 11:24:32PM -0600, M. Warner Losh wrote:
: > In message: <20080420103910.GA92852 at owl.midgard.homeip.net>
: > Erik Trulsson <ertr1013 at student.uu.se> writes:
: > : On Sun, Apr 20, 2008 at 12:02:09PM +0300, emily becker wrote:
: > : > Hi,
: > : >
: > : > I have a question about symbol table.
: > : > One of the section In symbol table is memory adress which symbol is located.
: > : > I wonder if this memory adress is bound at run-time or compile-time?
: > :
: > : It depends. Symbols referring to objects in a dynamically loaded library
: > : will be bound at run-time, the rest should be bound at compile-time.
: > They are bound at link-time, not compile-time. This is splitting a
: > fine hair, but compile-time is when a .o or .so is created, while link
: > time combines .o-like things together into a bigger thing.
: Well, I consider linking to be part of the compilation process so for
: me link-time is a subset of compile-time.
: You are however completely correct that it is at link-time that the binding
: happens (for those symbols that can be resolved at link-time anyway.)
While you might consider them the same, these are very important
differences that need to be taken into account. A compile-time
constant, for example, can be used to size an automatic array. A
link-time or run-time constant cannot without gcc's extensions (magic
tricks can be played to make link-time constants size certain global
objects, but then sizeof() those objects fail).
The terminology is well worn, and matters in some contexts, so I tend
to be a stickler here...
More information about the freebsd-hackers