static linking

Erik Postma epostma at nl.tue.win
Sat Nov 22 13:20:51 PST 2003


On Sat, 22 Nov 2003 02:28:45 -0200, michael <michael8110 at terra.com.br>
wrote:
> i'm probably making a target of myself with this one,but if static
> linking means inserting the source code of needed libraries into the
> program's own source code before compiling,how can you link statically
> against already compiled libraries ,i mean where is the source code for
> these libraries to be found if they've been compiled a long time ago,as
> for example in the beginning of ch 5,when we are statically linking
> against the host's libraries?Also in the 1st pass of binutils,at the end
> the linker ld is removed and recompiled with static linking against the
> newly compiled /tools/lib.And what's the deal with static linking in
> this case anyway,since the libraries are not the host's
> anymore?Questions,questions,questions...

It's not actually inserting the _source_ code. More like the (compiled)
object code. The difference with dynamic linking is that in the dynamic
case, you don't add the code at all, only a reference to where it can be
found and how to call it. This is probably oversimplifying stuff though...

-- 
Erik Postma (Email: reverse the order of nl, tue and win.)



More information about the lfs-support mailing list