gas/
authorJulian Brown <julian@codesourcery.com>
Wed, 16 Aug 2006 10:37:32 +0000 (10:37 +0000)
committerJulian Brown <julian@codesourcery.com>
Wed, 16 Aug 2006 10:37:32 +0000 (10:37 +0000)
* config/tc-arm.c (md_assemble): Improve diagnostic when attempting
to use ARM instructions on non-ARM-supporting cores.
(autoselect_thumb_from_cpu_variant): New function. Switch on Thumb
mode automatically based on cpu variant.
(md_begin): Call above function.

gas/testsuite/
* gas/arm/noarm.s: Add test for disabled ARM insns.
* gas/arm/noarm.d: Drive test for above.
* gas/arm/noarm.l: Expected error output.

ChangeLog.csl
gas/config/tc-arm.c

index e25c8d3..502d2f3 100644 (file)
@@ -1,5 +1,20 @@
 2006-08-16  Julian Brown  <julian@codesourcery.com>
 
+       gas/
+       * config/tc-arm.c (md_assemble): Improve diagnostic when attempting
+       to use ARM instructions on non-ARM-supporting cores.
+       (autoselect_thumb_from_cpu_variant): New function. Switch on Thumb
+       mode automatically based on cpu variant.
+       (md_begin): Call above function.
+
+       gas/testsuite/
+       * gas/arm/noarm.s: Add test for disabled ARM insns.
+       * gas/arm/noarm.d: Drive test for above.
+       * gas/arm/noarm.l: Expected error output.
+
+2006-08-16  Julian Brown  <julian@codesourcery.com>
+
+       gas/
        * config/tc-arm.c (opcode_lookup): Allow Neon type suffixes to be
        recognized in non-unified syntax mode.
 
index ff03cc9..9c3077a 100644 (file)
@@ -13809,7 +13809,7 @@ md_assemble (char *str)
        ARM_MERGE_FEATURE_SETS (thumb_arch_used, thumb_arch_used,
                                arm_ext_v6t2);
     }
-  else
+  else if (ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v1))
     {
       /* Check that this instruction is supported for this CPU.  */
       if (!opcode->avariant ||
@@ -13842,6 +13842,12 @@ md_assemble (char *str)
        ARM_MERGE_FEATURE_SETS (arm_arch_used, arm_arch_used,
                                *opcode->avariant);
     }
+  else
+    {
+      as_bad (_("attempt to use an ARM instruction on a Thumb-only processor "
+               "-- `%s'"), str);
+      return;
+    }
   output_inst (str);
 }
 
@@ -18846,6 +18852,16 @@ set_constant_flonums (void)
       abort ();
 }
 
+/* Auto-select Thumb mode if it's the only available instruction set for the
+   given architecture.  */
+
+static void
+autoselect_thumb_from_cpu_variant (void)
+{
+  if (!ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v1))
+    opcode_select (16);
+}
+
 void
 md_begin (void)
 {
@@ -18946,6 +18962,8 @@ md_begin (void)
 
   ARM_MERGE_FEATURE_SETS (cpu_variant, *mcpu_cpu_opt, *mfpu_opt);
 
+  autoselect_thumb_from_cpu_variant ();
+
   arm_arch_used = thumb_arch_used = arm_arch_none;
 
 #if defined OBJ_COFF || defined OBJ_ELF