This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] gas/arc: Allow --with-cpu configure option to change default cpu
- From: Nick Clifton <nickc at redhat dot com>
- To: Andrew Burgess <andrew dot burgess at embecosm dot com>
- Cc: binutils at sourceware dot org, Claudiu dot Zissulescu at synopsys dot com
- Date: Wed, 29 Jun 2016 14:15:52 +0100
- Subject: Re: [PATCH] gas/arc: Allow --with-cpu configure option to change default cpu
- Authentication-results: sourceware.org; auth=none
- References: <1465319268-8131-1-git-send-email-andrew dot burgess at embecosm dot com> <ba497073-2aa9-db20-e764-5d184138d171 at redhat dot com> <20160627184732 dot GA8823 at embecosm dot com> <966bd275-64bd-3e34-76d4-681a5bf79266 at redhat dot com> <20160629112051 dot GE8823 at embecosm dot com>
Hi Andrew,
> I've attached a new revision, this includes NEWS entry, and the help
> text that makes it clear the option is only supported on ARC.
Sorry - this version still has a few problems:
1. If you configure a toolchain as "--target=arc-elf", but do
not provide a --with-cpu= option, then the assembler fails
to run, producing this error:
Assembler messages:
Fatal error: unknown architecture:
This is because the config script sets TARGET_WITH_CPU to be "".
(In the code fragments below I have assumed that this has been corrected
so that TARGET_WITH_CPU is not defined unless --with-cpu is used).
2. The patch does not provide a way for the user to find out the default
cpu type. Ideally this should be included in the --help output, like this:
@@ -3401,7 +3405,7 @@ md_show_usage (FILE *stream)
{
fprintf (stream, _("ARC-specific assembler options:\n"));
- fprintf (stream, " -mcpu=<cpu name>\t assemble for CPU <cpu name>\n");
+ fprintf (stream, " -mcpu=<cpu name>\t assemble for CPU <cpu name> (default: %s)\n", TARGET_WITH_CPU);
Additionally, you might like to extend the text displayed with --version
so that it includes the cpu type as well. Like this:
diff --git a/gas/as.c b/gas/as.c
index 8784fb4..90f18c0 100644
--- a/gas/as.c
+++ b/gas/as.c
@@ -665,8 +665,13 @@ parse_args (int * pargc, char *** pargv)
This program is free software; you may redistribute it under the terms of\n\
the GNU General Public License version 3 or later.\n\
This program has absolutely no warranty.\n"));
+#ifdef TARGET_WITH_CPU
+ printf (_("This assembler was configured for a target of `%s' and default cpu type `%s'\n"),
+ TARGET_ALIAS, TARGET_WITH_CPU);
+#else
printf (_("This assembler was configured for a target of `%s'.\n"),
TARGET_ALIAS);
+#endif
exit (EXIT_SUCCESS);
case OPTION_EMULATION:
3. Please could you change:
> +dnl Option --with-cpu=TYPE allows configure type control of the default
> +dnl cpu type within the assembler. Not all targets support this option
> +dnl yet, which is why there is no help string, check the code to see if
> +dnl your target supports this option.
> +AC_ARG_WITH(cpu,
> + AS_HELP_STRING([--with-cpu=CPU],
> + [default cpu variant is CPU (only supported on ARC)]),
> + [],[])
to:
+dnl Option --with-cpu=TYPE allows configure type control of the default
+dnl cpu type within the assembler. Currently only the ARC target
+dnl supports this feature, but others may be added in the future.
+AC_ARG_WITH(cpu,
+ AS_HELP_STRING([--with-cpu=CPU],
+ [default cpu variant is CPU (currently only supported on ARC)]),
+ [],[])
4. Optional: There is no error checking of with --with-cpu value. So I can
configure with --with-cpu=fred and not get an error until I try to run the
assembler. Fixing this might not actually be a good idea since it will
involve duplicating the list of acceptable cpu names, meaning that there
would then be two lists that need to be kept in sync.
Cheers
Nick