<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/95698>95698</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[flang][compiler-rt] incompatible names for clang_rt.builtins
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
h-vetinari
</td>
</tr>
</table>
<pre>
On windows, flang expects to link whatever is returned by `getCompilerRTBasename`:
https://github.com/llvm/llvm-project/blob/630a6dd687ab4ec2038fc957fc8722c983aa4147/clang/lib/Driver/ToolChains/Flang.cpp#L285-L288
That function in turn just forwards whatever `getCompilerRT` yields
https://github.com/llvm/llvm-project/blob/edabb5c12ed9312c3366286a69e881f625102a85/clang/lib/Driver/ToolChain.cpp#L632-L637
(though there _would_ be an aptly-named `buildCompilerRTBasename` that presumably should power `getCompilerRTBasename`).
AFAICT, this was recently changed (e.g. https://github.com/llvm/llvm-project/commit/b876596a76cdc183439b36455d26883b67f8ee51, CC @maskray) to not append the arch-suffix by default -- apparently there is a "new layout", though for some reason, the default run-times install still produces only
```
%INSTALL_PREFIX%/lib/windows/clang_rt.asan-preinit-x86_64.lib
%INSTALL_PREFIX%/lib/windows/clang_rt.asan-x86_64.lib
%INSTALL_PREFIX%/lib/windows/clang_rt.asan_cxx-x86_64.lib
%INSTALL_PREFIX%/lib/windows/clang_rt.asan_dll_thunk-x86_64.lib
%INSTALL_PREFIX%/lib/windows/clang_rt.asan_dynamic-x86_64.dll
%INSTALL_PREFIX%/lib/windows/clang_rt.asan_dynamic-x86_64.lib
%INSTALL_PREFIX%/lib/windows/clang_rt.asan_dynamic_runtime_thunk-x86_64.lib
%INSTALL_PREFIX%/lib/windows/clang_rt.asan_static-x86_64.lib
%INSTALL_PREFIX%/lib/windows/clang_rt.builtins-x86_64.lib
%INSTALL_PREFIX%/lib/windows/clang_rt.fuzzer-x86_64.lib
%INSTALL_PREFIX%/lib/windows/clang_rt.fuzzer_interceptors-x86_64.lib
%INSTALL_PREFIX%/lib/windows/clang_rt.fuzzer_no_main-x86_64.lib
%INSTALL_PREFIX%/lib/windows/clang_rt.profile-x86_64.lib
%INSTALL_PREFIX%/lib/windows/clang_rt.stats-x86_64.lib
%INSTALL_PREFIX%/lib/windows/clang_rt.stats_client-x86_64.lib
%INSTALL_PREFIX%/lib/windows/clang_rt.ubsan_standalone-x86_64.lib
%INSTALL_PREFIX%/lib/windows/clang_rt.ubsan_standalone_cxx-x86_64.lib
%INSTALL_PREFIX%/lib/windows/orc_rt-x86_64.lib
```
-- in other words, all respective libraries still have the arch suffix.
When trying to compile something with flang (built from main) on windows -- in the same way that did work with LLVM 17&18 --, this then yields:
```
LINK : fatal error LNK1104: cannot open file 'clang_rt.builtins.lib'
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVsFu2zgQ_Rr6MpAhURJFHXxIkzUQ1NtddIPdvRkUNbLYUKRAUnbcr1_QctI2zWGLCAhiWJae5r0ZznvCe3UwiBtSfiDl3UpMobdu0ydHDMoIp1aNbc-bPwyclGntyRN6C50W5gD4NKIMHoIFrcwjnHoR8IgOlAeHYXIGW2jOQFh6wHBrh1FpdJ8fPgiPRgxIWEryG5LekfSmD2H08RvdEro9qNBPzVragdCt1sfnj2R09gvKQOi20bYhdMvyVLC2ZbwSTYGSpjnvZF1WneQVpbLmuRBFVlSEbmUsOgKp-OCdU0d0hG4frNW3vVDGE7rdxnvWchwJzXeUl8mOcj5XOP9_6EWAbjIyKGtAGYg04cvkA3TWnYRr_TcdXhMnLIWzQt3695HGVjRNKTOKbZ1nVOY5Y5QzwWrkPOsYLbOUCl7-D9LPXFlOkx3LqytXykNvp0MPoUeHsD_ZSbd7aBCEATEGfU5iB9tIsZmUbt_sLoSo1ujQT4No9Bl8H3FgtKc31Pl-LGi9_l71m-3N_e1DnLzQKw8nEQdMogn6DLIX5hAroRzXhzX8sqjSDoO6qMsrVtZ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