[PATCH] D153707: [Clang][LoongArch] Consume and check -mabi and -mfpu even if -m*-float is present
WÁNG Xuěruì via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Jun 24 11:04:10 PDT 2023
xen0n created this revision.
xen0n added reviewers: SixWeining, wangleiat, hev, xry111, MaskRay.
Herald added a subscriber: tpr.
Herald added a project: All.
xen0n requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
This kind of CLI flags duplication can sometimes be convenient for build
systems that may have to tinker with these.
For example, in the Linux kernel we almost always want to ensure no FP
instruction is emitted, so `-msoft-float` is present by default; but
sometimes we do want to allow FPU usage (e.g. certain parts of amdgpu DC
code), in which case we want the `-msoft-float` stripped and `-mfpu=64`
added. Here we face a dilemma without this change:
- Either `-mabi` is not supplied by `arch/loongarch` Makefile, in which case the correct ABI has to be supplied by the driver Makefile, potentially duplicating logic;
- Or `-mabi` is still supplied by `arch/loongarch` Makefile, and the build immediately errors out because `-Werror,-Wunused-command-line-argument` is unconditionally set for Clang builds.
To solve this, simply make sure to check `-mabi` and `-mfpu` (and gain
some useful diagnostics in case of conflicting settings) when
`-m*-float` is successfully parsed.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D153707
Files:
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/lib/Driver/ToolChains/Arch/LoongArch.cpp
clang/test/Driver/loongarch-mdouble-float.c
clang/test/Driver/loongarch-msingle-float.c
clang/test/Driver/loongarch-msoft-float.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153707.534239.patch
Type: text/x-patch
Size: 8085 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230624/9c6d4c55/attachment.bin>
More information about the cfe-commits
mailing list