[Clang] Confusing diagnostic when using `-fsanitize=function -mexecute-only` flags together on ARM targets
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.
@llvm/issue-subscribers-clang-driver
Author: Csanád Hajdú (Il-Capitano)
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.