This patch allows Clang to pass on -Wa,-mfpu, -Wa,-mhwdiv and
-Wa,-mcpu to the integrated assembler (via target-features), but
-march is still not being passed, but validated.
Fixes PR20700. Depends on D11147.
Paths
| Differential D11148
[ARM] Implement -Wa,-mfpu and friends for assemblers ClosedPublic Authored by rengolin on Jul 13 2015, 8:41 AM.
Details
Diff Detail Event Timelinerengolin updated this object. rengolin added a parent revision: D11147: [ARM] Changes to Arch/CPU handling to help with -Wa,-mfpu etc. (nfc).Jul 13 2015, 8:42 AM rengolin mentioned this in D11147: [ARM] Changes to Arch/CPU handling to help with -Wa,-mfpu etc. (nfc). rengolin updated this object. Comment Actions I find it confusing that both -mcpu and -Wa,-mcpu are honoured. Shouldn't be warn about conflicts? Comment Actions
My reasoning is that in build systems, CFLAGS is set differently, and where people use the compiler to assemble files, it's common to have ASFLAGS as a composition of CFLAGS and extra options, like -Wa flags. FWIW, GCC doesn't warn either. Comment Actions My point remains that -mcpu is already passed to the assembler, so having both -Wa,-mcpu and -mcpu and using one over the other *independent* of order is violates POLA. Comment Actions So, what do you suggest? A warning might break -Werror builds that already depend on this option to work. Checking the last option is not possible using filters, since they have different types. Replacing -Wa,-mfpu by -mfpu Arg inplace (to allow for last-of filtering) is not possible, since the ArgList is const. When there is only -Wa and no -mfpu, not doing anything gets the wrong behaviour. Any other ideas? cheers, Comment Actions Sorry for ignoring this. I looked at it, didn't like the approach, but couldn't think of a better one. Here's a dumb idea: what if we alias -Wa,-mcpu= to -mcpu=? This would have the unintended side effect of making -Wa,-mcpu affect the CPU used for *compilation* in addition to assembly, but that seems like not a very big deal. If that's OK, it solves the whole getLastArg problem without complicating the driver C++ code.
rengolin edited edge metadata. Comment ActionsNow warning over double use of naked -mxxx and asm -Wa,-mxxx. Also, improving the tests. Comment Actions
Welcome to my world... This is not my first attempt... :)
It would, but the behaviour that makes most sense if for the -Wa to override the naked options for the assembler, and never be used for the compiler. If we merge them, -Wa options will work for compilation, too, and won't override naked options when it should. rnk edited edge metadata. Comment Actionslgtm
This revision is now accepted and ready to land.Jul 27 2015, 4:03 PM
Revision Contents
Diff 30366 lib/Driver/Tools.cpp
test/Driver/arm-ias-Wa.s
|
You probably want to clang-format the patch.