<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64939>64939</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang: 'argument unused during compilation: '-rtlib=compiler-rt' warning when using -nostdlib
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
nolange
</td>
</tr>
</table>
<pre>
Hello,
I have a cmake project which includes some kinda plugins that need to be built with `-nostdlib`.
Using a toochain-file for clang which adds `-rtlib=compiler-rt` for linker steps will result in wrong warnings,
for the plugins as those 2 flags are then used together.
Small reproducer:
``` bash
echo "void foo() {}" > test.c
clang -c -o test.o test.c
clang -rtlib=compiler-rt -nostdlib --shared test.o
```
```
clang: warning: argument unused during compilation: '-rtlib=compiler-rt' [-Wunused-command-line-argument]
```
I believe this to be a bug, as
- I want to use `-rtlib=compiler-rt` if an runtime is needed (defined in a toolchain file for the whole build),
making this flag optional in regard to other options would be a compiler-specific mess.
- setting `-nostdlib++` and `-stdlib=libc++` is similar and doesnt result in a warning.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVM1u6zYTfRp6M5ChULZlLbRIrj_jy7oouh6RY2kaijQ4ZIy-fUHJ8XWL4G4KCDbB-T1nDgdFePREvdq_qf1pgzlNIfY-OPQjbYZg_-r_T84FpX-o-qTq1_X3HSb8JEAwM34QXGP4k0yC28RmAvbGZUsCEmaCD_YW4eryyF4gTZjAE1lIAQaCIbNLcOM0gTrUlQ-SrONBHertWul3YT8CQgrBTMi-urAjuIQIpvR4L4nWypIgphLdnEyYr-woVjGpQ734O_YfFEESXQVu7BxEkuwSsIdbDCUXRs9-lAfYEpYmenSPBUAQAg0Xh6MARioOHrIskEZKE8XtM1W_zbiUusZgs6GomtdnszrU6wcDyrTekZkCKK0_A1u4hKD0UekOVPum2pPSGlTzP0gkaWvWgJWKykAV1vvwnfkbbuDBOFSVTBgLiiXBv7r7tuWn7Kp5_aKvHDGOeSafIPuFGZtjGeNaGRMHX7yUbr8dmG5B7d-qP9bgyoR5Rm8rx56qr8xqf_pFi-8wkGP6LNNhuWsNYcij0j8A5dm3AoB3uKFPxS8L_UpIfAH0ELNPPBOwLFomC0ofLV3Yky1yWuTqFr3CQ69FSLcpuFX0VunuoTMAgBk_CkVLv0VcEK6FJ3QlYaQR4_JmQhHY3SZwC9nZFdujUbmS4QsbmElk-4VRKKWS_x-vTL-V71ADertY7vfNyfFgfppZQHhmh3HxtIHEp6fng1-zv5fb2L6xXdPhhvqXQ6ePetfsm83Ud42t9WE_XHRtm92ubjW1--5l_2KO2NnuuOFe17qpj7rR9b57abZtS2ZHQ3fEo6ZW79SuphnZbZ37nLchjhsWydQfdl3TbRwO5GTZZlp7usFiVFqX5Rb7ElMNeRS1qx1Lkp9ZEidH_UPLSrf_WcN3TuC2LohyfFC_ydH1U0pXKftAn5U-j5ymPGxNmJU-l77uf9V9uyp9XtCI0ucF7d8BAAD__3Od15U">