Morden linkers are smart. But sometimes too smart than what we need, that we would have to tell them what exactly we want.
Say, that a binary A uses some, but not all, symbols in a static library B, the linker would extract those symbol in-use from B and put them into A.
But sometimes, we do not want the linker to be as smart as this; instead, we might want all symbols in B are put into A.
To do so using GNU ln (usually comes with Linux), we say
g++ -o A -Wl,-whole-archive libB.a -Wl,-no-whole-archive A.cc
To do exactly the same thing using ln from Mac OS X, we say
g++ -o A A.cc -all_load libB.a
A typical situation that depends on above tricks is to link a self-registering class factory, and here is an example.