[PATCH 02/30] [arm] Rewrite -march and -mcpu options for passing to the assembler

Richard Earnshaw Richard.Earnshaw@arm.com
Fri Jun 9 12:54:00 GMT 2017


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.
---
 gcc/common/config/arm/arm-common.c | 45 +++++++++++++++++++++++++++++++++++++-
 gcc/config/arm/arm.h               | 42 +++++++++++++++++------------------
 2 files changed, 65 insertions(+), 22 deletions(-)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-arm-Rewrite-march-and-mcpu-options-for-passing-to-th.patch
Type: text/x-patch
Size: 4818 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20170609/fa9c5c88/attachment.bin>


More information about the Gcc-patches mailing list