[arm] Don't strip off all architecture features from -march passed to assembler
authorRichard Earnshaw <rearnsha@arm.com>
Fri, 8 Dec 2017 11:14:09 +0000 (11:14 +0000)
committerRichard Earnshaw <rearnsha@gcc.gnu.org>
Fri, 8 Dec 2017 11:14:09 +0000 (11:14 +0000)
commit24531cd697943064c58ef0c374751f667657fe38
treec0b3bd15a4cdcad7e63dce4caaa4dd7e6cfd3143
parent940269b679a628dbb1f3891b7e57b80db6743615
[arm] Don't strip off all architecture features from -march passed to assembler

When GCC invokes the assembler it generates a sanitized version of the
user-specified -march option to pass through, since the assembler does
not understand all the new FPU-related architectural options.
Unfortunately it goes too far and strips off all the architectural
extensions, including some that are unrelated to the -mfpu variant
selected.

Again, this doesn't really matter when compiling C code because the
compiler will override the command-line specified architecture with
directives in the assembly file itself, but when using the compiler
driver to invoke the assembler the only indiciation of the desired
architecture might come from the command line.

We fix this by adjusting the canonicalization pass to remove any
option that only specifies features that can be expressed by -mfpu
(any that go beyond that are already supported by the assembler).  We
do have to take care to re-order the options, though as the assembler
expects feature options to be in a canonical order (unlike the
compiler, where ordering is handled left-to-right: there's only a
difference if there are negation options, but a canonicalized
architecture string shouldn't have any of those).  We do this by
recording which options we need and then sorting the final list
alphabetically.

* common/config/arm/arm-common.c: Include <algorithm>.
(INCLUDE_VECTOR): Define.
(compare_opt_names): New function.
(arm_rewrite_selected_arch): Only strip out extensions that can be
expressed through -mfpu.  Sort the remaining extensions
alphabetically.

From-SVN: r255503
gcc/ChangeLog
gcc/common/config/arm/arm-common.c