* config/tc-arm.c (md_assemble): Improve diagnostic when attempting
authorJulian Brown <julian@codesourcery.com>
Wed, 16 Aug 2006 10:33:50 +0000 (10:33 +0000)
committerJulian Brown <julian@codesourcery.com>
Wed, 16 Aug 2006 10:33:50 +0000 (10:33 +0000)
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/ChangeLog
gas/config/tc-arm.c

index 2a8146be2464328baf5ca1e913c3a6f555248d01..6c7928d3a774e7fe838a905e4638737527b05781 100644 (file)
@@ -1,3 +1,11 @@
+2006-08-16  Julian Brown  <julian@codesourcery.com>
+
+       * 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.
+
 2006-08-16  Julian Brown  <julian@codesourcery.com>
 
        * config/tc-arm.c (opcode_lookup): Allow Neon type suffixes to be
index dc3d7a22ce393b2d65bfb77e15543094ec50f3e7..577c76c1204e16f80861dc513d6ef325e2cb57da 100644 (file)
@@ -13844,7 +13844,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 ||
@@ -13877,6 +13877,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);
 }
 
@@ -18957,6 +18963,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)
 {
@@ -19057,6 +19073,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