rust/compiler
bors 757a65bfdf Auto merge of #88250 - rusticstuff:macos-lld, r=nagisa
Make `-Z gcc-ld=lld` work for Apple targets

`-Z gcc-ld=lld` was introduced in #85961. It does not work on Macos because lld needs be either named `ld64` or passed `-flavor darwin` as the first two arguments in order to select the Mach-O flavor. Rust invokes cc (=clang) on Macos for linking which calls `ld` as linker binary and not `ld64`, so just creating an `ld64` binary and modifying the search path with `-B` does not work.

In order to solve this patch does:
* Set the `lld_flavor` for all Apple-derived targets to `LldFlavor::Ld64`. As far as I can see this actually works towards fixing `-Xlinker=rust-lld` as all those targets use the Mach-O object format.
* Copy/hardlink rust-lld to the gcc-ld subdirectory as ld64 next to ld.
* If `-Z gcc-ld=lld` is used and the target lld flavor is Ld64 add `-fuse-ld=/path/to/ld64` to the linker invocation.

Fixes #86945.
2021-08-29 04:51:14 +00:00
..
2021-08-27 05:07:37 +00:00
2021-08-27 05:07:37 +00:00
2021-08-25 20:24:39 +02:00
2021-08-27 05:07:37 +00:00
2021-08-26 11:14:31 +02:00
2021-08-28 00:16:34 -07:00
2021-08-28 00:16:34 -07:00
2021-08-28 00:16:34 -07:00
2021-08-27 05:07:37 +00:00
2021-08-28 00:16:34 -07:00
2021-08-28 00:16:34 -07:00
fmt
2021-08-27 08:09:00 +00:00