Repository: rust
Issue: Cross-compile a cdylib failed on target mipsel-unknown-linux-musl
Labels: A-linkage

<!--
Thank you for filing a bug report! 🐛 Please provide a short summary of the bug,
along with any information you feel relevant to replicating the bug.
-->

Hello, I've written a simple Rust library and compiled it for several targets. I found that it compiles successfully on x86_64-unknown-linux-gnu and x86_64-apple-darwin, both as dynamic and static libraries. However, when targeting mipsel-unknown-linux-musl, only the static library compiles successfully. When attempting to compile a dynamic library, I encountered different issues on macOS and Ubuntu. 

On macOS, the error is:  
```
ld: unknown option: --version-script=/var/folders/xh/250r_b1d10q0kklv9g7rwq4c0000gn/T/rustctZ046f/list
          clang: error: linker command failed with exit code 1 (use -v to see invocation)
```
On ubuntu, the error is:
```
  = note: /usr/bin/ld: /home/zouyalong/mercku/mercku_os/rust/libmap/target/mipsel-unknown-linux-musl/release/deps/map.map.e6b571e945e58e5d-cgu.0.rcgu.o: Relocations in generic ELF (EM: 8)
          /usr/bin/ld: /home/zouyalong/mercku/mercku_os/rust/libmap/target/mipsel-unknown-linux-musl/release/deps/map.map.e6b571e945e58e5d-cgu.0.rcgu.o: Relocations in generic ELF (EM: 8)
          /usr/bin/ld: /home/zouyalong/mercku/mercku_os/rust/libmap/target/mipsel-unknown-linux-musl/release/deps/map.map.e6b571e945e58e5d-cgu.0.rcgu.o: Relocations in generic ELF (EM: 8)
          /usr/bin/ld: /home/zouyalong/mercku/mercku_os/rust/libmap/target/mipsel-unknown-linux-musl/release/deps/map.map.e6b571e945e58e5d-cgu.0.rcgu.o: Relocations in generic ELF (EM: 8)
          /usr/bin/ld: /home/zouyalong/mercku/mercku_os/rust/libmap/target/mipsel-unknown-linux-musl/release/deps/map.map.e6b571e945e58e5d-cgu.0.rcgu.o: Relocations in generic ELF (EM: 8)
          /usr/bin/ld: /home/zouyalong/mercku/mercku_os/rust/libmap/target/mipsel-unknown-linux-musl/release/deps/map.map.e6b571e945e58e5d-cgu.0.rcgu.o: Relocations in generic ELF (EM: 8)
          /usr/bin/ld: /home/zouyalong/mercku/mercku_os/rust/libmap/target/mipsel-unknown-linux-musl/release/deps/map.map.e6b571e945e58e5d-cgu.0.rcgu.o: Relocations in generic ELF (EM: 8)
          /home/zouyalong/mercku/mercku_os/rust/libmap/target/mipsel-unknown-linux-musl/release/deps/map.map.e6b571e945e58e5d-cgu.0.rcgu.o: error adding symbols: File in wrong format
          collect2: error: ld returned 1 exit status
```

I expected to see this happen: *shared library can be built*


### Meta
<!--
If you're using the stable version of the compiler, you should also check if the
bug also exists in the beta or nightly versions.
-->
*macos*:
`rustc --version --verbose`:
```
rustc 1.72.0-nightly (fe7454bf4 2023-06-19)
binary: rustc
commit-hash: fe7454bf439c93cbe9ac8a8f7fcfacd5a40244c2
commit-date: 2023-06-19
host: x86_64-apple-darwin
release: 1.72.0-nightly
LLVM version: 16.0.5
```
*ubuntu*
`rustc --version --verbose`:
```
rustc 1.73.0 (cc66ad468 2023-10-03)
binary: rustc
commit-hash: cc66ad468955717ab92600c770da8c1601a4ff33
commit-date: 2023-10-03
host: x86_64-unknown-linux-gnu
release: 1.73.0
LLVM version: 17.0.2
```
<!--
Include a backtrace in the code block by setting `RUST_BACKTRACE=1` in your
environment. E.g. `RUST_BACKTRACE=1 cargo build`.
-->
<details><summary>Backtrace</summary>
<p>

```
<backtrace>
```

</p>
</details>