This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[ARM] fix big.LITTLE spec rewriting


Hi,

As with the AArch64 case,
( http://gcc.gnu.org/ml/gcc-patches/2014-01/msg01317.html )
the way that we rewrite command lines for big.LITTLE systems
causes bugs where more than one source file is to be used.

The solution here is identical to that proposed for AArch64,
we update the spec command and compensate for that with an
change to arm_rewrite_mcpu to handle multiple names.

The patch has been bootstrapped on a chromebook, and I've
checked combinations of zero or more -mcpu values with
one or more source files, and things seem to work as expected.

OK?

Thanks,
James

---
2014-01-21  James Greenhalgh  <james.greenhalgh@arm.com>

	* common/config/arm/arm-common.c
	(arm_rewrite_mcpu): Handle multiple names.
	* config/arm/arm.h
	(BIG_LITTLE_SPEC): Do not discard mcpu switches.
diff --git a/gcc/common/config/arm/arm-common.c b/gcc/common/config/arm/arm-common.c
index 065de7d..8ef8d83 100644
--- a/gcc/common/config/arm/arm-common.c
+++ b/gcc/common/config/arm/arm-common.c
@@ -86,13 +86,15 @@ arm_rewrite_selected_cpu (const char *name)
 
 /* Called by the driver to rewrite a name passed to the -mcpu
    argument in preparation to be passed to the assembler.  The
-   name will be in ARGV[0], ARGC should always be 1.  */
+   names passed from the commend line will be in ARGV, we want
+   to use the right-most argument, which should be in
+   ARGV[ARGC - 1].  ARGC should always be greater than 0.  */
 
 const char *
 arm_rewrite_mcpu (int argc, const char **argv)
 {
-  gcc_assert (argc == 1);
-  return arm_rewrite_selected_cpu (argv[0]);
+  gcc_assert (argc);
+  return arm_rewrite_selected_cpu (argv[argc - 1]);
 }
 
 #undef ARM_CPU_NAME_LENGTH
diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
index b815488..bed056e 100644
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
@@ -2356,7 +2356,7 @@ extern int making_const_table;
 #define MAX_LDM_STM_OPS 4
 
 #define BIG_LITTLE_SPEC \
-   " %{mcpu=*:%<mcpu=* -mcpu=%:rewrite_mcpu(%{mcpu=*:%*})}" \
+   " %{mcpu=*:-mcpu=%:rewrite_mcpu(%{mcpu=*:%*})}"
 
 extern const char *arm_rewrite_mcpu (int argc, const char **argv);
 #define BIG_LITTLE_CPU_SPEC_FUNCTIONS \

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]