x86: don't accept base architectures as extensions
authorJan Beulich <jbeulich@suse.com>
Thu, 17 Mar 2022 10:05:56 +0000 (11:05 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 17 Mar 2022 10:05:56 +0000 (11:05 +0100)
The -march= intentions are quite clear: A base architecture may be
followed by any number of extensions. Accepting a base architecture in
place of an extension will at best result in confusion, as the first of
the two (or more) items specified simply would not take effect, due to
being overridden by the later one(s).

gas/config/tc-i386.c
gas/testsuite/gas/i386/arch-10-5.l [new file with mode: 0644]
gas/testsuite/gas/i386/arch-10-5.s [new file with mode: 0644]
gas/testsuite/gas/i386/i386.exp

index 1ff5fd8e453ad8f2c5211affb87bbe78b1a1adb8..1cc14feeccf45c8434f67ce89bfa5c79b4e3b7a9 100644 (file)
@@ -13262,7 +13262,7 @@ md_parse_option (int c, const char *arg)
            *next++ = '\0';
          for (j = 0; j < ARRAY_SIZE (cpu_arch); j++)
            {
-             if (strcmp (arch, cpu_arch [j].name) == 0)
+             if (arch == saved && strcmp (arch, cpu_arch [j].name) == 0)
                {
                  /* Processor.  */
                  if (! cpu_arch[j].flags.bitfield.cpui386)
diff --git a/gas/testsuite/gas/i386/arch-10-5.l b/gas/testsuite/gas/i386/arch-10-5.l
new file mode 100644 (file)
index 0000000..25dc404
--- /dev/null
@@ -0,0 +1,2 @@
+Assembler messages:
+Fatal error: .*
diff --git a/gas/testsuite/gas/i386/arch-10-5.s b/gas/testsuite/gas/i386/arch-10-5.s
new file mode 100644 (file)
index 0000000..09cc1e1
--- /dev/null
@@ -0,0 +1 @@
+       .text
index da5c2f6b806ea79f00441046a865164b2716fbe6..3c157e9eb1e7c1fe1725bef0ddc0320089bdbc68 100644 (file)
@@ -199,6 +199,7 @@ if [gas_32_check] then {
     run_list_test "arch-10-2" "-march=i686 -I${srcdir}/$subdir -al"
     run_list_test "arch-10-3" "-march=i686+mmx+sse4.2 -I${srcdir}/$subdir -al"
     run_list_test "arch-10-4" "-march=i686+mmx+sse4+vmx+smx -I${srcdir}/$subdir -al"
+    run_list_test "arch-10-5" "-march=generic32+i686 -al"
     run_dump_test "arch-11"
     run_dump_test "arch-12"
     run_dump_test "arch-13"