static linking (more)

michael michael8110 at terra.com.br
Sun Nov 23 15:55:44 PST 2003


thank you Shane and Eric,but let then us carry on : in ch 5,' toolchain 
technical notes ',you can read 'do not confuse the dynamic linker or loader 
,provided by glibc,with the static linker ld in binutils ' and further ' the 
dynamic linker, ld-linux.so.2 ,is what finds and loads the shared libs needed 
by a program and then RUNS it ' so i guess this is what you meant with 
respect to dynamic linking.Now let's try to understand what goes on at the 
beginning of ch 5: Binutils is compiled first,statically,which means that the 
host system's library object files are written into "a few big happy 
executables" by the host's ld, so as far as i can understand,no dynamic 
linking needed for them to run,right,and after that,ld is removed and 
rebuilt,statically again (make -C ld LD_FLAGS="-all-static" 
LIB_PATH=/tools/lib") ,so now we have a static linker ld rebuilt with the new 
binutil's libraries ,but it will still need the host's ld to run,since it has 
been built statically!! I'll wait for some feedback before moving on,but at 
this stage one can already ask why static linking? Couldn't these first three 
packages (binutils,gcc and glibc) that make up the toolchain have been built 
dynamically and then been made to use their own libs at runtime( glibc and 
whatever ),becoming thus independent of the host? I guess it pays to think 
this over,since it's the essence of the method,don't you agree?Um abraço 
(that's portuguese for a  casual hug,    :-)  ).



More information about the lfs-support mailing list