[PATCH] D159173: [Driver] Report warnings for unlaimed TargetSpecific options for assembler input
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 30 00:35:52 PDT 2023
MaskRay created this revision.
MaskRay added reviewers: jansvoboda11, thesamesam, chill, peter.smith, simon_tatham, stuij.
Herald added subscribers: kadircet, kristof.beyls.
Herald added a reviewer: ctetreau.
Herald added a project: All.
MaskRay requested review of this revision.
Herald added subscribers: cfe-commits, wangpc, ilya-biryukov.
Herald added a project: clang.
This patch amends D151590 <https://reviews.llvm.org/D151590> to not error for unlaimed TargetSpecific
options for `-x assembler` input files. This input type causes Driver to
construct tools::ClangAs (-fintegrated-as) or other assemblers (e.g.
tools::gnutools::Assembler) Their ConstructJobs methods, unlike
Clang::ConstructJobs, claim very few options. If an option is unclaimed,
it either leads to a -Wunused-command-line-argument warning or an error
(if `TargetSpecific` is set):
% clang '-###' --target=aarch64 -mbranch-protection=bti -c a.s
clang: error: unsupported option '-mbranch-protection=' for target 'aarch64'
It seems that downgrading the diagnostic to warning is most useful as
many users use CFLAGS even for `.s` files:
clang --target=aarch64 -mbranch-protection=bti -S a.c
clang --target=aarch64 -mbranch-protection=bti -c a.s
I decide not to suppress the warning so that
-Wunused-command-line-argument lovers still get a warning, and help
projects use proper ASFLAGS/CFLAGS/etc.
Note: `-mbranch-protection=bti a.S` currently has no warning as `-x assembler-with-cpp`
instructs clangDriver to select tools::Clang and claim most options.
Revert D159010 <https://reviews.llvm.org/D159010> to demonstrate that we emit a warning for -mfpmath= for
`-x assembler` input.
Modify my AIX cleanup cd18efb61d759405956dbd30e4b5f2720d8e1783 <https://reviews.llvm.org/rGcd18efb61d759405956dbd30e4b5f2720d8e1783> to
add an err_drv_unsupported_opt_for_target.
Planned for main and release/17.x
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D159173
Files:
clang/lib/Driver/Driver.cpp
clang/lib/Driver/ToolChains/AIX.cpp
clang/lib/Driver/ToolChains/Arch/X86.cpp
clang/lib/Driver/ToolChains/Arch/X86.h
clang/lib/Driver/ToolChains/CommonArgs.cpp
clang/test/Driver/aarch64-target-as-march.s
clang/test/Driver/target-specific.s
clang/test/Driver/x86-mfpmath.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159173.554607.patch
Type: text/x-patch
Size: 6701 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230830/3fe61cd8/attachment.bin>
More information about the cfe-commits
mailing list