Fix linking with --as-needed ld(1) option.