<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/117974>117974</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Clang] Confusing diagnostic when using `fsanitize=function -mexecute-only` flags together on ARM targets
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Il-Capitano
</td>
</tr>
</table>
<pre>
When passing `fsanitize=function -mexecute-only` to Clang on an ARM target, it prints the following error:
```
error: invalid argument '-fsanitize=function' not allowed with 'arm-unknown-linux-gnueabi'
```
The error happens because `-fsanitize=function` is incompatible with execute-only memory, but prints the target triple as the reason. I would expect the error message to be the following in this case:
```
error: invalid argument '-fsanitize=function' not allowed with '-mexecute-only'
```
The diagnostic is created here:
https://github.com/llvm/llvm-project/blob/69d66fafec968b17f84e30bc09faffb3dc8e5f15/clang/lib/Driver/SanitizerArgs.cpp#L416-L423
I think a good solution would be to print `-mexecute-only` (or `-mpure-code`) as the reason for the incompatibility if it was passed to the compiler driver, and print the target triple otherwise.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0lEtv4zYQxz8NfRnIoKinDzq4DgwE2F7aAj2PqKHELkUKfMRJP31B2YvsJnvZQwEDtsXRPH7_4R9D0LMlGljzG2ueDpji4vzwbIoLbjqidYfRTW_D3wtZ2HK0nYG1XAW0Oup_iVVPKlkZtbNQrPRKMkUqnDVvrOUQHVwM2hmcBbRw_uN3iOhnikxcQEfYvLYxQFwIlDPG3XJ68t55Vp0ZP7OWPz78_O0xaPuCRk-Afk4r2QhMdMXPGmKiA-siYM5ME9x0XHIw-rVI9qt1N1sYbdNrMdtEOGomug9F_1ro3g8suG1kA4wkMQXKEH5etOWgA2gr3bph1KOhe-Hv2cBKq_NvmcKYfsBwxwPR680Q4P2hJwzOHuEZbi6ZCeh1Ixn3o3tzK4WAM2XeI33AqS3ERQeQGOj_pPpB_U8oHzQnjbN1IWqZMUlPGGmChfyjuSXGLeSf4srEddZxSeNRupWJqzEv376Kzbt_SEYmrqNxIxPX9jS1rUJF8tT2Y9mpvqaKj5KfFCo1VpPsqVFlw8RV5pXMiXR-8cnrF_JMXP98zOrPfg5HuW1MVF_qsi2-1KK6D_CcUdqvgDA7N0FwJu2bf5dl3AXYxdzX49N1YKJ3_n60JU-FdBNlOOL0o9KgnN__vm-RNjq-gVb51tww7HeRplwvx-UobcjD9BjmAminRyuf18rFhfxNBzoepqGaTtUJDzSUXSW6nte8PSwD9gLrjvoGSTUl572qqeWqr9WopKragx4EF3VZip53TSWaI3Xi1LWyIy67ti45qzmtqM0x63V0fj7oEBINZdmduvpgcCQTdt8R4qGIyBbkh13gMc2B1dzoEMN7iqij2c1qtxXWPMHFWZV2W_pus27ZrtIvmpUyOAeIbqaMJ1vWu1-FQ_Jm-OXd3CcOTFwfQ78M4r8AAAD__woy0Qo">