This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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]

Re: [PATCH] gas/arc: Allow --with-cpu configure option to change default cpu


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


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