Fix obscure problem with using the system linker (#8935)