3 ms·
You have program X, and Y, both depending on big library L with 1000 symbols. X uses 1 symbol l1 from L, Y use another symbol l2 from L. With dynamic linking
by ajuc 11y ago
You have program X, and Y, both depending on big library L with 1000 symbols.
X uses 1 symbol l1 from L, Y use another symbol l2 from L.
With dynamic linking you need the whole library, no matter how much of it you use. With static linking (and --gc-sections -fdata-sections) you have parts of L compiled into X and Y binaries, but just the functions used (and their dependencies). It's possible that l1 and l2 share dependencies - and these will be duplicated. But still static linking is likely to be net win.
Dynamic linking is mostly about maintanance.