Static linking considered harmful

Ulrich Drepper drepper at redhat.com
Fri Nov 24 22:03:37 UTC 2006


Chris Adams wrote:
> I've never tried that.  I wonder just how hard it would be to get
> something useful.  Could you decompose a statically linked binary and
> relink it (against the same glibc, etc.) to get a dynamically linked
> binary (that should then work with newer glibcs)?  Once a static binary
> is stripped, I don't think there's enough information left, is there?

This is only possible (if ever) when all the relocations are kept in the 
final binary.  There is a linker option to do this but it doesn't really 
work reliably.

Regardless, the object file/source distinction is meaningless anyway. 
The object files encode ABI internals.  Those change and make object 
file reuse impossible (we never guarantee compatibility of object files, 
only executables and DSOs).  Therefore I argue that without distributing 
sources people linking statically are always violating the license since 
they don't allow relinking with later or earlier versions.

-- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖




More information about the fedora-devel-list mailing list