[arm] Rewrite -march and -mcpu options for passing to
authorRichard Earnshaw <rearnsha@arm.com>
Fri, 16 Jun 2017 21:01:29 +0000 (21:01 +0000)
committerRichard Earnshaw <rearnsha@gcc.gnu.org>
Fri, 16 Jun 2017 21:01:29 +0000 (21:01 +0000)
commit867944533b944953804d3dc88bae280160599a04
treebcdd048963fde9c7926aee8fd673d28fe990ba93
parent80448ef60264c49c8b08e700b64a5d338d3806ba
[arm] Rewrite -march and -mcpu options for passing to

The assembler does not understand all the '+' options accepted by the
compiler.  The best solution to this is to simply strip the extensions
and just pass the raw architecture or cpu name through to the
assembler.  We will use .arch and .arch_extension directives anyway to
turn on or off individual features.  We already do something similar
for big.little combinations and this just extends this principle a bit
further.  This patch also fixes a possible bug by ensuring that the
limited string copy is correctly NUL-terminated.

While messing with this code I've also taken the opportunity to clean up
the duplicate definitions of EXTRA_SPEC_FUNCTIONS by moving it outside of
the ifdef wrapper.

* config/arm/arm.h (BIG_LITTLE_SPEC): Delete macro.
(ASM_REWRITE_SPEC_FUNCTIONS): New macro.
(BIG_LITTLE_CPU_SPEC_FUNCTIONS): Delete macro.
(ASM_CPU_SPEC): Rewrite.
(MCPU_MTUNE_NATIVE_FUNCTIONS): New macro.
(EXTRA_SPEC_FUNCTIONS): Move outside of ifdef.  Use
MCPU_MTUNE_NATIVE_FUNCTIONS and ASM_REWRITE_SPEC_FUNCTIONS.  Remove
reference to BIG_LITTLE_CPU_SPEC_FUNCTIONS.
* common/config/arm/arm-common.c (arm_rewrite_selected_cpu): Ensure
copied string is NUL-terminated.  Also strip any characters prefixed
by '+'.
(arm_rewrite_selected_arch): New function.
(arm_rewrite_march): New function.

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