<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=http://email.email.llvm.org/c/eJylVE1v2zgQ_TXyZWBBH7YTH3TI5gM16jRAUxR7KyhqJHFNiQJJRfW_3xlKTr3ZXhYLCJbJod68efOGpanOxbdWOaDHohYeK_AG0jxO4nRt5Z9Qjh4OIFuUJ461CNEu6YTq6QWlFb1sQfRzRJtGSXCInQtrJzqMo-QhSu7m3wPBKV2BAD8ZcF40CNJ0g9JowfTQCfnyGuBGh3A8PjAZrfrTDIfSUCh8FkOgrVFUjg9xvDZam0n1DaC1xsLUYg_ennmHjjDkR5gov7vmRzUtT1hKLfpmneZ0aobkP6p_E1pV8IbWKeLcj11J7FUPUXaz7pgt2vUSjfKH3SamwG_xL6JUqmlIXK5b-UU_rU4z3UACZCdOWJNOUKFH6WeB52TvVFq0XBG03g-OS8ue6GmUb8cyJp1pofXb5bUerPmLoGhZalPSK7Q1ewoZ6X3_TDmPynkX-590LD9ukt0186lV1H3sKyrQwThALZRmtdk0TNjBp5fXbz-Ohy-ff3x__Pp6ePnC9tlt2DwT8QLNbnC8ef989_kxHH38SssPviFRgmdq9RPde9fSKNvDfUt0F50CkaAVBLGo7VTlgFafF-FmV3Bass8gnMNA4EpNboND_xvqi88ucpuaLPr9GYSnbUYzqvfAxiM2MylqJ30k9CTO7t2ArXH-kiywmZmxcP_KOdeZcZ0L5C9PVFYRlZBAShwWFhd2axpb0cHYu9FyzmkOq8CjAp714FrGW5CCAWsmLaQfhSbR5i6K_gxuQKmEJrJScQIHpWAg0wfgf_TrkxiGMxObrPJI4z4IT04hbLpKRA8NyetMR01CrEohT4wytSSkWPpFYT16rmMyIzWrvFwkq6rIq32-Fysx-tbYwttxNVpd_GfTK-dG8lL2tM03-9tVW2R1Ve8wKbOa5CxvbvLb7SbLd7clyioVVbrSokTtimj7R5Rls9_yu9qa3ocZoC7d0yWQkblo_1nI9uXX5kCC18Z2FKFbzjiObB9W_5-3KrIky5I0T9MkudnuY9zXab4rb_b1Lk9uExFtEqTJ1jHjxMY2K1sEyHJsHAV1mPD3II2EanrEUCYx9MprLA41XA8o24hnhFpMs6oruuS4aprq6wFZxosOfbwXoSHDsa_me3UVaipCQX8DvkEpVA>53498</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
If CMAKE_LINKER is set to `ld64.lld` the version passed to -mlinker-version gives an error
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:frontend,
lld:MachO,
platform:macos
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
tru
</td>
</tr>
</table>
<pre>
This is related to 13.0.1-rcX but I checked the `main` branch and the logic seems the same.
I build a two stage compiler on macOS and use LLD to link the second stage. This leads to the following error when trying to use the second stage:
```
clang-13: error: invalid version number in '-mlinker-version=64.'
```
I digged and it seems like the clang cmakefile detects the linker version here: https://github.com/llvm/llvm-project/blob/main/clang/CMakeLists.txt#L406
which end's up failing but makes HOST_LINK_VERSION `64` with lld as `CMAKE_LINKER`.
I see two fixes:
1) Change clang's cmake file to properly detect when lld is passed as the linker and set HOST_LINK_VERSION to the version of LLVM at this point or we change it to always use the host linker when detecting HOST_LINK_VERSION
2) change the clang driver to accept this version - I am unsure how this is used later in the driver and if it actually makes any special decisions based on this.
Happy to write a patch if I can get some feedback on what a proper solution would be.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVVE1v2zgQ_TXyZWBBH44TH3Tw5gM16jRAUxS9FRRJSVxTpEBSUf3vd4aSU2-2lwUEy-RQM2_ee8PainP1rVMe8HFSsyAFBAt5mWZpvnb8B9RjgAPwTvITxToJyTbrmTL4gtoxwztgZo5o2yoOXsrex7VnvUyT7CHJ9vPvAdMpLYBBmCz4wFoJ3PaD0tKBNdAz_vIa041ewvH4QGC0Mqc5neQWQ_GzFCJsLZnwdIjijdXaTsq0IJ2zDqZOGgjuTDt4hFJ-TJOU-2t82NPyxCXXzLTrvMRTc0r6o8wb00rAm3ReI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