@@ -66,7 +66,7 @@ arm_except_unwind_info (struct gcc_options *opts)
#define ARM_CPU_NAME_LENGTH 20
-/* Truncate NAME at the first '.' character seen, or return
+/* Truncate NAME at the first '.' or '+' character seen, or return
NAME unmodified. */
const char *
@@ -76,12 +76,20 @@ arm_rewrite_selected_cpu (const char *name)
char *arg_pos;
strncpy (output_buf, name, ARM_CPU_NAME_LENGTH);
+ output_buf[ARM_CPU_NAME_LENGTH] = 0;
+
arg_pos = strchr (output_buf, '.');
/* If we found a '.' truncate the entry at that point. */
if (arg_pos)
*arg_pos = '\0';
+ arg_pos = strchr (output_buf, '+');
+
+ /* If we found a '+' truncate the entry at that point. */
+ if (arg_pos)
+ *arg_pos = '\0';
+
return output_buf;
}
@@ -98,6 +106,41 @@ arm_rewrite_mcpu (int argc, const char **argv)
return arm_rewrite_selected_cpu (argv[argc - 1]);
}
+/* Truncate NAME at the first '+' character seen, or return
+ NAME unmodified. Similar to arm_rewrite_selected_cpu, but we must
+ preserve '.' as that is part of some architecture names. */
+
+const char *
+arm_rewrite_selected_arch (const char *name)
+{
+ static char output_buf[ARM_CPU_NAME_LENGTH + 1] = {0};
+ char *arg_pos;
+
+ strncpy (output_buf, name, ARM_CPU_NAME_LENGTH);
+ output_buf[ARM_CPU_NAME_LENGTH] = 0;
+
+ arg_pos = strchr (output_buf, '+');
+
+ /* If we found a '+' truncate the entry at that point. */
+ if (arg_pos)
+ *arg_pos = '\0';
+
+ return output_buf;
+}
+
+/* Called by the driver to rewrite a name passed to the -march
+ argument in preparation to be passed to the assembler. The
+ names passed from the command 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_march (int argc, const char **argv)
+{
+ gcc_assert (argc);
+ return arm_rewrite_selected_arch (argv[argc - 1]);
+}
+
struct arm_arch_core_flag
{
const char *const name;
@@ -2219,42 +2219,42 @@ extern int making_const_table;
instruction. */
#define MAX_LDM_STM_OPS 4
-#define BIG_LITTLE_SPEC \
- " %{mcpu=*:-mcpu=%:rewrite_mcpu(%{mcpu=*:%*})}"
-
extern const char *arm_rewrite_mcpu (int argc, const char **argv);
-#define BIG_LITTLE_CPU_SPEC_FUNCTIONS \
- { "rewrite_mcpu", arm_rewrite_mcpu },
+extern const char *arm_rewrite_march (int argc, const char **argv);
+#define ASM_CPU_SPEC_FUNCTIONS \
+ { "rewrite_mcpu", arm_rewrite_mcpu }, \
+ { "rewrite_march", arm_rewrite_march },
-#define ASM_CPU_SPEC \
- " %{mcpu=generic-*:-march=%*;" \
- " :%{march=*:-march=%*}}" \
- BIG_LITTLE_SPEC
+#define ASM_CPU_SPEC \
+ " %{mcpu=generic-*:-march=%:rewrite_march(%{mcpu=generic-*:%*});" \
+ " march=*:-march=%:rewrite_march(%{march=*:%*});" \
+ " mcpu=*:-mcpu=%:rewrite_mcpu(%{mcpu=*:%*})" \
+ " }"
extern const char *arm_target_thumb_only (int argc, const char **argv);
-#define TARGET_MODE_SPEC_FUNCTIONS \
+#define TARGET_MODE_SPEC_FUNCTIONS \
{ "target_mode_check", arm_target_thumb_only },
/* -mcpu=native handling only makes sense with compiler running on
an ARM chip. */
#if defined(__arm__)
extern const char *host_detect_local_cpu (int argc, const char **argv);
-# define EXTRA_SPEC_FUNCTIONS \
- { "local_cpu_detect", host_detect_local_cpu }, \
- BIG_LITTLE_CPU_SPEC_FUNCTIONS \
- TARGET_MODE_SPEC_FUNCTIONS
-
-# define MCPU_MTUNE_NATIVE_SPECS \
- " %{march=native:%<march=native %:local_cpu_detect(arch)}" \
- " %{mcpu=native:%<mcpu=native %:local_cpu_detect(cpu)}" \
+# define MCPU_MTUNE_NATIVE_FUNCTIONS \
+ { "local_cpu_detect", host_detect_local_cpu },
+# define MCPU_MTUNE_NATIVE_SPECS \
+ " %{march=native:%<march=native %:local_cpu_detect(arch)}" \
+ " %{mcpu=native:%<mcpu=native %:local_cpu_detect(cpu)}" \
" %{mtune=native:%<mtune=native %:local_cpu_detect(tune)}"
#else
+# define MCPU_MTUNE_NATIVE_FUNCTIONS
# define MCPU_MTUNE_NATIVE_SPECS ""
-# define EXTRA_SPEC_FUNCTIONS \
- BIG_LITTLE_CPU_SPEC_FUNCTIONS \
- TARGET_MODE_SPEC_FUNCTIONS
#endif
+# define EXTRA_SPEC_FUNCTIONS \
+ MCPU_MTUNE_NATIVE_FUNCTIONS \
+ ASM_CPU_SPEC_FUNCTIONS \
+ TARGET_MODE_SPEC_FUNCTIONS
+
/* Automatically add -mthumb for Thumb-only targets if mode isn't specified
via the configuration option --with-mode or via the command line. The
function target_mode_check is called to do the check with either: