rustc_trans: Link archives with `--whole-archive`

If archives are passed to linker, linker does not add all object files
but instead scans each object in archive then adds it only if it
defines some symbols which has been undefined.
It is problematic when rlib needs to be contained in dylib, since
some portion of rlib is stripped out if unused by dylib itself.

This patch uses `--whole-archive` flag which changes linker behavior
that the linker just adds all objects in archive.
Unfortunately, ld does not accept rlib as-is because it contains
non-object files, so they are manually removed before passed to ld.

Also, this change can be problematic if several archives actually
contain same symbol. For example, this patch breaks code like:

```Rust
    #![crate_type = "rlib"]

    // `libcfoo.a` contains `foo`.
    #![link(name = "cfoo", kind = "static")]
    extern {}

    // `foo` is also defined here!
    #[no_mangle]
    pub fn foo() {}

    // so this rlib archive has two `foo` symbols.
```

Previously it worked because linker stripped out `cfoo`.

Fixes #14344