[PATCH] x86: reject architecture settings that are invalid to be set from the command line
Jan Beulich
JBeulich@novell.com
Wed Jun 9 15:36:00 GMT 2010
More information about the Binutils mailing list
Wed Jun 9 15:36:00 GMT 2010
- Previous message (by thread): [patch]: make bfd/som.c host neutral
- Next message (by thread): [PATCH] x86: reject architecture settings that are invalid to be set from the command line
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
So far, options like -march=i8086 were accepted despite the assembler subsequently choking on other consistency checks, leading to reasonably cryptic error messages. This patch makes it so that impossible architecure settings are neither accepted nor displayed (i.e. it is now made sure that those settings can only be used via directives). gas/ 2010-06-09 Jan Beulich <jbeulich@novell.com> * config/tc-i386.c (md_parse_option): Ignore impossible processor types. (show_arch): New parameter 'check'. (md_show_usage): Adjust calls to show_arch(). --- 2010-06-09/gas/config/tc-i386.c 2010-06-09 17:04:12.000000000 +0200 +++ 2010-06-09/gas/config/tc-i386.c 2010-06-09 17:24:59.000000000 +0200 @@ -8166,6 +8166,11 @@ md_parse_option (int c, char *arg) if (strcmp (arch, cpu_arch [j].name) == 0) { /* Processor. */ + if (! (strcmp (default_arch, "i386") + ? cpu_arch[j].flags.bitfield.cpulm + : cpu_arch[j].flags.bitfield.cpui386)) + continue; + cpu_arch_name = cpu_arch[j].name; cpu_sub_arch_name = NULL; cpu_arch_flags = cpu_arch[j].flags; @@ -8297,7 +8302,7 @@ md_parse_option (int c, char *arg) " " static void -show_arch (FILE *stream, int ext) +show_arch (FILE *stream, int ext, int check) { static char message[] = MESSAGE_TEMPLATE; char *start = message + 27; @@ -8334,6 +8339,13 @@ show_arch (FILE *stream, int ext) /* It is an processor. Skip if we show only extension. */ continue; } + else if (check && ! (strcmp (default_arch, "i386") + ? cpu_arch[j].flags.bitfield.cpulm + : cpu_arch[j].flags.bitfield.cpui386)) + { + /* It is an impossible processor - skip. */ + continue; + } /* Reserve 2 spaces for ", " or ",\0" */ left -= len + 2; @@ -8398,13 +8410,13 @@ md_show_usage (FILE *stream) fprintf (stream, _("\ -march=CPU[,+EXTENSION...]\n\ generate code for CPU and EXTENSION, CPU is one of:\n")); - show_arch (stream, 0); + show_arch (stream, 0, 1); fprintf (stream, _("\ EXTENSION is combination of:\n")); - show_arch (stream, 1); + show_arch (stream, 1, 0); fprintf (stream, _("\ -mtune=CPU optimize for CPU, CPU is one of:\n")); - show_arch (stream, 0); + show_arch (stream, 0, 0); fprintf (stream, _("\ -msse2avx encode SSE instructions with VEX prefix\n")); fprintf (stream, _("\
- Previous message (by thread): [patch]: make bfd/som.c host neutral
- Next message (by thread): [PATCH] x86: reject architecture settings that are invalid to be set from the command line
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list