Difference between ‘ld’ and ‘ld.so’

ldlinker

While both are called "linker" and are used to link binaries, I can't really figure out how they differ from each other. Can anyone tell me their differences?

Best Answer

Without getting too technical: Both are "linkers", i.e. a tool that combines/loads a piece of compiled code with/into another piece of compiled code.

ld is a static linker, while ld.so is a dynamic linker.

The letters so are, I believe, short for "shared object", and you'll usually see it as a file name suffix of shared libraries, i.e. libraries that may be dynamically linked into programs (one library is "shared" among several programs). In contrast, a static library often has the file name suffix .a, for "archive" (created by the ar utility).

A static linker links a program or library at compile-time, usually as the last step in the compilation process, creating a binary executable or a library. In the case of a binary executable file, it may be a static binary with all libraries loaded into the binary itself, or it may be a dynamically linked binary with only some libraries statically linked.

A dynamic linker loads the libraries that were dynamically linked at compile-time into the process' address space at run-time.

See the manuals for ld and ld.so on your system.

Related Question