[PATCH] D151590: [Driver] Add ClangFlags::TargetSpecific to simplify err_drv_unsupported_opt_for_target processing
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 13 12:59:35 PDT 2023
MaskRay added a comment.
@jansvoboda11
For ELF operating systems (that traditionally use GCC), I think unsupported `-m*` options as errors are very desired as that's the GCC behavior and some configure system will prefer it.
I think x86 `-m*` options are the most possible options to be misused.
% clang -c --target=aarch64-unknown-linux-gnu -msse4.2 a.c # warning instead of error, not ideal
clang: warning: argument unused during compilation: '-msse4.2' [-Wunused-command-line-argument]
% aarch64-linux-gnu-gcc -msse4.2 a.c
aarch64-linux-gnu-gcc: error: unrecognized command-line option ‘-msse4.2’
For macOS universal binary builds (`-arch`), I wonder whether we want to refine the current behavior:
% clang -fdriver-only -c --target=x86_64-apple-darwin -arch arm64 -arch x86_64 -mavx512vl a.c # no warning
% clang -fdriver-only -c --target=x86_64-apple-darwin -arch arm64 -mavx512vl a.c # no -arch x86_64
clang: warning: argument unused during compilation: '-mavx512vl' [-Wunused-command-line-argument] # or an error if we make mavx512vl TargetSpecific
The `-arch arm64 -mavx512vl ` situation isn't very common. Though not-carefully-written CMake may make the mistakes: `llvm/lib/Support/BLAKE3/CMakeLists.txt` (fixed by f231829304d15dca0dad8bafe35c4277904db602 <https://reviews.llvm.org/rGf231829304d15dca0dad8bafe35c4277904db602>) and in-tree misuse: tsan (https://github.com/llvm/llvm-project/issues/63270).
(I think the two use sites are unusual.)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D151590/new/
https://reviews.llvm.org/D151590
More information about the cfe-commits
mailing list