2006-10-31 Paul Brook <paul@codesourcery.com>
authorPaul Brook <paul@codesourcery.com>
Tue, 31 Oct 2006 20:16:33 +0000 (20:16 +0000)
committerPaul Brook <paul@codesourcery.com>
Tue, 31 Oct 2006 20:16:33 +0000 (20:16 +0000)
gas/
* config/tc-arm.c (object_arch): New variable.
(s_arm_object_arch): New function.
(md_pseudo_table): Add object_arch.
(aeabi_set_public_attributes): Obey object_arch.
* doc/c-arm.texi: Document .object_arch.

gas/ChangeLog
gas/config/tc-arm.c
gas/doc/c-arm.texi

index 15185503a5824fbb4ab5e70c895970e428521c61..3907b9a22fb3abb6b3436837110aa5fe15e554de 100644 (file)
@@ -1,3 +1,12 @@
+2006-10-31  Paul Brook  <paul@codesourcery.com>
+
+       gas/
+       * config/tc-arm.c (object_arch): New variable.
+       (s_arm_object_arch): New function.
+       (md_pseudo_table): Add object_arch.
+       (aeabi_set_public_attributes): Obey object_arch.
+       * doc/c-arm.texi: Document .object_arch.
+
 2006-10-31  Mei Ligang  <ligang@sunnorth.com.cn>
 
        * tc-score.c (data_op2): Check invalid operands.
index 64d75aa984d0502a7b413f91451f006efe559fc9..40c598ec6a86e7d7ea98cfaf6f8714dabd749826 100644 (file)
@@ -155,6 +155,7 @@ static const arm_feature_set *mcpu_fpu_opt = NULL;
 static const arm_feature_set *march_cpu_opt = NULL;
 static const arm_feature_set *march_fpu_opt = NULL;
 static const arm_feature_set *mfpu_opt = NULL;
+static const arm_feature_set *object_arch = NULL;
 
 /* Constants for known architecture features.  */
 static const arm_feature_set fpu_default = FPU_DEFAULT;
@@ -3890,6 +3891,7 @@ bad:
 #endif /* OBJ_ELF */
 
 static void s_arm_arch (int);
+static void s_arm_object_arch (int);
 static void s_arm_cpu (int);
 static void s_arm_fpu (int);
 
@@ -3943,6 +3945,7 @@ const pseudo_typeS md_pseudo_table[] =
   { "syntax",     s_syntax,      0 },
   { "cpu",        s_arm_cpu,     0 },
   { "arch",       s_arm_arch,    0 },
+  { "object_arch", s_arm_object_arch,  0 },
   { "fpu",        s_arm_fpu,     0 },
 #ifdef OBJ_ELF
   { "word",       s_arm_elf_cons, 4 },
@@ -20236,7 +20239,13 @@ aeabi_set_public_attributes (void)
   ARM_MERGE_FEATURE_SETS (flags, arm_arch_used, thumb_arch_used);
   ARM_MERGE_FEATURE_SETS (flags, flags, *mfpu_opt);
   ARM_MERGE_FEATURE_SETS (flags, flags, selected_cpu);
-    
+  /*Allow the user to override the reported architecture.  */
+  if (object_arch)
+    {
+      ARM_CLEAR_FEATURE (flags, flags, arm_arch_any);
+      ARM_MERGE_FEATURE_SETS (flags, flags, *object_arch);
+    }
+
   tmp = flags;
   arch = 0;
   for (p = cpu_arch_ver; p->val; p++)
@@ -20400,6 +20409,37 @@ s_arm_arch (int ignored ATTRIBUTE_UNUSED)
 }
 
 
+/* Parse a .object_arch directive.  */
+
+static void
+s_arm_object_arch (int ignored ATTRIBUTE_UNUSED)
+{
+  const struct arm_arch_option_table *opt;
+  char saved_char;
+  char *name;
+
+  name = input_line_pointer;
+  while (*input_line_pointer && !ISSPACE(*input_line_pointer))
+    input_line_pointer++;
+  saved_char = *input_line_pointer;
+  *input_line_pointer = 0;
+
+  /* Skip the first "all" entry.  */
+  for (opt = arm_archs + 1; opt->name != NULL; opt++)
+    if (streq (opt->name, name))
+      {
+       object_arch = &opt->value;
+       *input_line_pointer = saved_char;
+       demand_empty_rest_of_line ();
+       return;
+      }
+
+  as_bad (_("unknown architecture `%s'\n"), name);
+  *input_line_pointer = saved_char;
+  ignore_rest_of_line ();
+}
+
+
 /* Parse a .fpu directive.  */
 
 static void
index 7fede6cf9f9eec74d1f75632ff71205cda782ff5..2fea463c54efb95b0d54830e8b83bb12f815ea4f 100644 (file)
@@ -585,6 +585,12 @@ for the @option{-mcpu} commandline option.
 Select the target architecture.  Valid values for @var{name} are the same as
 for the @option{-march} commandline option.
 
+@cindex @code{.object_arch} directive, ARM
+@item .object_arch @var{name}
+Override the architecture recorded in the EABI object attribute section.
+Valid values for @var{name} are the same as for the @code{.arch} directive.
+Typically this is useful when code uses runtime detection of CPU features.
+
 @cindex @code{.fpu} directive, ARM
 @item .fpu @var{name}
 Select the floating point unit to assemble for.  Valid values for @var{name}