Add linker flags to resolve weak symbols correctly

An important linker flag got missed from previous commits! The "--whole-archive" flag persuades the linker to consider all symbols in an archive instead of just picking first it finds.