This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, gas/ARM] Clean up selection of feature bits


I've always found the code in ARM backend of gas to control what
CPU/architecture and FPU are selected by the user and to support
autodetection of features complex and confusing. Chief among the
issues I have with that code is the lack of comments to explain
the meaning of the various variables. This patch addresses that
and much more:

- add comments to explain meaning of all arm_feature_set variables
- keep track of currently selected CPU, extensions and FPU in a separate
  set of new variables
- make naming of variable more consistent
- remove dead code
- simplify handling of extensions

The overall approach is as follows:

* restrict m*_opt variable to hold the feature bits of the
  corresponding mcpu/march/mfpu command-line options
* record selected CPU, extensions and FPU in new selected_* during
  md_begin
* whenever a .cpu/.arch/.arch_extension/.fpu directive is met, update
  the corresponding selected_* variables (eg. selected_arch, then
  selected_cpu for a .cpu or .arch directive) and then finally
  cpu_variant from them
* pass extension feature set pointer by value to arm_parse_extension
  since it's only ever called from arm_parse_cpu and arm_parse_arch
  which allocate the extension feature set themselves
* likewise, remove allocation from s_arm_arch_extension since the use
  of arm_feature_set structure for selected_ext rather than a pointer
  alleviate the need for it
* in autodetection mode, only set all CPU fits in cpu_variant but leave
  selected_cpu* variables unset
* in md_begin, remove dead "else if" to set a default FPU when no FPU
  was selected. Setting a default FPU based on CPU as did the code
  before it turn dead should be based on the default FPU field of the
  CPU and architecture table as will be done in a separate patch. Logic
  is wrong anyway since it sets VFP2 as default FPU for Armv6-M and
  Armv7-M

Hopefully that should be enough to understand the change but if not feel
free to ask questions about the patch. While I believe the new code is
easier to understand, it remains complex and the old one was even more
complex so the change is difficult to understand.

ChangeLog entry is as follows:

*** gas/ChangeLog ***

2018-02-21  Thomas Preud'homme  <thomas.preudhomme@arm.com>

	* config/tc-arm.c (cpu_variant, arm_arch_used, thumb_arch_used,
	legacy_cpu, legacy_fpu, mcpu_cpu_opt, dyn_mcpu_ext_opt,
	mcpu_fpu_opt, march_cpu_opt, dyn_march_ext_opt, march_fpu_opt,
	mfpu_opt, object_arch, selected_cpu): Comment meaning of variables.
	(dyn_mcpu_ext_opt): Also rename into ...
	(mcpu_ext_opt): This.
	(dyn_march_ext_opt): Also rename into ...
	(march_ext_opt): This.
	(object_arch): Also rename into ...
	(selected_object_arch): This and make it a plain arm_feature_set
	structure.
	(selected_arch, selected_ext, selected_fpu): New static variables.
	(do_bx): Adapt to change in name and type of object_arch.
	(md_begin): Set selected_arch rather than mcpu_cpu_opt, selected_ext
	rather than dyn_mcpu_ext_opt and selected_fpu rather than mfpu_opt.
	Remove dead code to set default FPU if architecture version is greater
	than 5.  Set all CPU bits of cpu_variant directly in autodection
	leaving mcpu_cpu_opt, selected_arch and selected_cpu unset.
	(arm_parse_extension): Take extension feature set pointer
	parameter by value rather than by pointer.  Remove allocation
	code.  Adapt code accordingly.
	(arm_parse_cpu): Adapt to variable renaming and changes in
	arm_parse_extension () signature.
	(arm_parse_arch): Likewise.
	(aeabi_set_public_attributes): Also set selected_arch and selected_ext
	in addition to selected_cpu.  Set flags_arch and flags_ext from them
	instead of selected_cpu.  Adapt to variables renaming and type change.
	(arm_md_post_relax): Adapt to variable renaming.
	(s_arm_cpu): Set selcted_cpu_cpu and selected_ext instead of
	mcpu_cpu_opt and dyn_mcpu_ext_opt.  Set selected_cpu from them
	and cpu_variant from selected_cpu and selected_fpu.
	(s_arm_arch): Likewise.
	(s_arm_object_arch): Adapt to variable renaming.
	(s_arm_arch_extension): Use ARM_CPU_IS_ANY instead of checking
	feature set against arm_any.  Check selected_arch rather than
	*mcpu_cpu_opt.  Set selected_ext rather than *dyn_mcpu_ext_opt and
	remove allocation code.
	(s_arm_fpu): Set selected_fpu instead of mfpu_opt.  Set all CPU
	feature bits if in autodetection mode.

Testing: Built binutils targeting arm-none-eabi and testsuite shows no
regression.

Ok for master?

Best regards,

Thomas
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index cac4ed9ab9712735bc8b3fb438add6267e2c0e51..f431b7ae1ebcae20bfceda77d402d74609c16f7e 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -123,7 +123,12 @@ enum arm_float_abi
 
 #define streq(a, b)	      (strcmp (a, b) == 0)
 
+/* Current set of feature bits available (CPU+FPU).  Different from
+   selected_cpu + selected_fpu in case of autodetection since the CPU
+   feature bits are then all set.  */
 static arm_feature_set cpu_variant;
+/* Feature bits used in each execution state.  Used to set build attribute
+   (in particular Tag_*_ISA_use) in CPU autodetection mode.  */
 static arm_feature_set arm_arch_used;
 static arm_feature_set thumb_arch_used;
 
@@ -143,17 +148,24 @@ bfd_boolean codecomposer_syntax = FALSE;
 /* Variables that we set while parsing command-line options.  Once all
    options have been read we re-process these values to set the real
    assembly flags.  */
-static const arm_feature_set *  legacy_cpu = NULL;
-static const arm_feature_set *  legacy_fpu = NULL;
-
-static const arm_feature_set *  mcpu_cpu_opt = NULL;
-static arm_feature_set *        dyn_mcpu_ext_opt = NULL;
-static const arm_feature_set *  mcpu_fpu_opt = NULL;
-static const arm_feature_set *  march_cpu_opt = NULL;
-static arm_feature_set *        dyn_march_ext_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;
+
+/* CPU and FPU feature bits set for legacy CPU and FPU options (eg. -marm1
+   instead of -mcpu=arm1).  */
+static const arm_feature_set *legacy_cpu = NULL;
+static const arm_feature_set *legacy_fpu = NULL;
+
+/* CPU, extension and FPU feature bits selected by -mcpu.  */
+static const arm_feature_set *mcpu_cpu_opt = NULL;
+static arm_feature_set *mcpu_ext_opt = NULL;
+static const arm_feature_set *mcpu_fpu_opt = NULL;
+
+/* CPU, extension and FPU feature bits selected by -march.  */
+static const arm_feature_set *march_cpu_opt = NULL;
+static arm_feature_set *march_ext_opt = NULL;
+static const arm_feature_set *march_fpu_opt = NULL;
+
+/* Feature bits selected by -mfpu.  */
+static const arm_feature_set *mfpu_opt = NULL;
 
 /* Constants for known architecture features.  */
 static const arm_feature_set fpu_default = FPU_DEFAULT;
@@ -302,8 +314,20 @@ static const arm_feature_set fpu_neon_ext_dotprod =
   ARM_FEATURE_COPROC (FPU_NEON_EXT_DOTPROD);
 
 static int mfloat_abi_opt = -1;
-/* Record user cpu selection for object attributes.  */
+/* Architecture feature bits selected by the last -mcpu/-march or .cpu/.arch
+   directive.  */
+static arm_feature_set selected_arch = ARM_ARCH_NONE;
+/* Extension feature bits selected by the last -mcpu/-march or .arch_extension
+   directive.  */
+static arm_feature_set selected_ext = ARM_ARCH_NONE;
+/* Feature bits selected by the last -mcpu/-march or by the combination of the
+   last .cpu/.arch directive .arch_extension directives since that
+   directive.  */
 static arm_feature_set selected_cpu = ARM_ARCH_NONE;
+/* FPU feature bits selected by the last -mfpu or .fpu directive.  */
+static arm_feature_set selected_fpu = FPU_NONE;
+/* Feature bits selected by the last .object_arch directive.  */
+static arm_feature_set selected_object_arch = ARM_ARCH_NONE;
 /* Must be long enough to hold any of the names in arm_cpus.  */
 static char selected_cpu_name[20];
 
@@ -8610,7 +8634,8 @@ do_bx (void)
   /* Output R_ARM_V4BX relocations if is an EABI object that looks like
      it is for ARMv4t or earlier.  */
   want_reloc = !ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_v5);
-  if (object_arch && !ARM_CPU_HAS_FEATURE (*object_arch, arm_ext_v5))
+  if (!ARM_FEATURE_ZERO (selected_object_arch)
+      && !ARM_CPU_HAS_FEATURE (selected_object_arch, arm_ext_v5))
       want_reloc = TRUE;
 
 #ifdef OBJ_ELF
@@ -25338,71 +25363,70 @@ md_begin (void)
       if (mcpu_cpu_opt || march_cpu_opt)
 	as_bad (_("use of old and new-style options to set CPU type"));
 
-      mcpu_cpu_opt = legacy_cpu;
+      selected_arch = *legacy_cpu;
     }
-  else if (!mcpu_cpu_opt)
+  else if (mcpu_cpu_opt)
+    {
+      selected_arch = *mcpu_cpu_opt;
+      selected_ext = *mcpu_ext_opt;
+    }
+  else if (march_cpu_opt)
     {
-      mcpu_cpu_opt = march_cpu_opt;
-      dyn_mcpu_ext_opt = dyn_march_ext_opt;
-      /* Avoid double free in arm_md_end.  */
-      dyn_march_ext_opt = NULL;
+      selected_arch = *march_cpu_opt;
+      selected_ext = *march_ext_opt;
     }
+  ARM_MERGE_FEATURE_SETS (selected_cpu, selected_arch, selected_ext);
 
   if (legacy_fpu)
     {
       if (mfpu_opt)
 	as_bad (_("use of old and new-style options to set FPU type"));
 
-      mfpu_opt = legacy_fpu;
+      selected_fpu = *legacy_fpu;
     }
-  else if (!mfpu_opt)
+  else if (mfpu_opt)
+    selected_fpu = *mfpu_opt;
+  else
     {
 #if !(defined (EABI_DEFAULT) || defined (TE_LINUX) \
 	|| defined (TE_NetBSD) || defined (TE_VXWORKS))
       /* Some environments specify a default FPU.  If they don't, infer it
 	 from the processor.  */
       if (mcpu_fpu_opt)
-	mfpu_opt = mcpu_fpu_opt;
+	selected_fpu = *mcpu_fpu_opt;
       else
-	mfpu_opt = march_fpu_opt;
+	selected_fpu = *march_fpu_opt;
 #else
-      mfpu_opt = &fpu_default;
+      selected_fpu = fpu_default;
 #endif
     }
 
-  if (!mfpu_opt)
+  if (ARM_FEATURE_ZERO (selected_fpu))
     {
-      if (mcpu_cpu_opt != NULL)
-	mfpu_opt = &fpu_default;
-      else if (mcpu_fpu_opt != NULL && ARM_CPU_HAS_FEATURE (*mcpu_fpu_opt, arm_ext_v5))
-	mfpu_opt = &fpu_arch_vfp_v2;
+      if (!no_cpu_selected ())
+	selected_fpu = fpu_default;
       else
-	mfpu_opt = &fpu_arch_fpa;
+	selected_fpu = fpu_arch_fpa;
     }
 
 #ifdef CPU_DEFAULT
-  if (!mcpu_cpu_opt)
+  if (ARM_FEATURE_ZERO (selected_arch))
     {
-      mcpu_cpu_opt = &cpu_default;
-      selected_cpu = cpu_default;
+      selected_arch = cpu_default;
+      selected_cpu = selected_arch;
     }
-  else if (dyn_mcpu_ext_opt)
-    ARM_MERGE_FEATURE_SETS (selected_cpu, *mcpu_cpu_opt, *dyn_mcpu_ext_opt);
-  else
-    selected_cpu = *mcpu_cpu_opt;
+  ARM_MERGE_FEATURE_SETS (cpu_variant, selected_cpu, selected_fpu);
 #else
-  if (mcpu_cpu_opt && dyn_mcpu_ext_opt)
-    ARM_MERGE_FEATURE_SETS (selected_cpu, *mcpu_cpu_opt, *dyn_mcpu_ext_opt);
-  else if (mcpu_cpu_opt)
-    selected_cpu = *mcpu_cpu_opt;
+  /*  Autodection of feature mode: allow all features in cpu_variant but leave
+      selected_cpu unset.  It will be set in aeabi_set_public_attributes ()
+      after all instruction have been processed and we can decide what CPU
+      should be selected.  */
+  if (ARM_FEATURE_ZERO (selected_arch))
+    ARM_MERGE_FEATURE_SETS (cpu_variant, arm_arch_any, selected_fpu);
   else
-    mcpu_cpu_opt = &arm_arch_any;
+    ARM_MERGE_FEATURE_SETS (cpu_variant, selected_cpu, selected_fpu);
 #endif
 
-  ARM_MERGE_FEATURE_SETS (cpu_variant, *mcpu_cpu_opt, *mfpu_opt);
-  if (dyn_mcpu_ext_opt)
-    ARM_MERGE_FEATURE_SETS (cpu_variant, cpu_variant, *dyn_mcpu_ext_opt);
-
   autoselect_thumb_from_cpu_variant ();
 
   arm_arch_used = thumb_arch_used = arm_arch_none;
@@ -26430,7 +26454,7 @@ struct arm_long_option_table
 
 static bfd_boolean
 arm_parse_extension (const char *str, const arm_feature_set *opt_set,
-		     arm_feature_set **ext_set_p)
+		     arm_feature_set *ext_set)
 {
   /* We insist on extensions being specified in alphabetical order, and with
      extensions being added before being removed.  We achieve this by having
@@ -26442,12 +26466,6 @@ arm_parse_extension (const char *str, const arm_feature_set *opt_set,
   const arm_feature_set arm_any = ARM_ANY;
   int adding_value = -1;
 
-  if (!*ext_set_p)
-    {
-      *ext_set_p = XNEW (arm_feature_set);
-      **ext_set_p = arm_arch_none;
-    }
-
   while (str != NULL && *str != 0)
     {
       const char *ext;
@@ -26525,10 +26543,9 @@ arm_parse_extension (const char *str, const arm_feature_set *opt_set,
 
 	    /* Add or remove the extension.  */
 	    if (adding_value)
-	      ARM_MERGE_FEATURE_SETS (**ext_set_p, **ext_set_p,
-				      opt->merge_value);
+	      ARM_MERGE_FEATURE_SETS (*ext_set, *ext_set, opt->merge_value);
 	    else
-	      ARM_CLEAR_FEATURE (**ext_set_p, **ext_set_p, opt->clear_value);
+	      ARM_CLEAR_FEATURE (*ext_set, *ext_set, opt->clear_value);
 
 	    /* Allowing Thumb division instructions for ARMv7 in autodetection
 	       rely on this break so that duplicate extensions (extensions
@@ -26589,9 +26606,9 @@ arm_parse_cpu (const char *str)
     if (opt->name_len == len && strncmp (opt->name, str, len) == 0)
       {
 	mcpu_cpu_opt = &opt->value;
-	if (!dyn_mcpu_ext_opt)
-	  dyn_mcpu_ext_opt = XNEW (arm_feature_set);
-	*dyn_mcpu_ext_opt = opt->ext;
+	if (mcpu_ext_opt == NULL)
+	  mcpu_ext_opt = XNEW (arm_feature_set);
+	*mcpu_ext_opt = opt->ext;
 	mcpu_fpu_opt = &opt->default_fpu;
 	if (opt->canonical_name)
 	  {
@@ -26611,7 +26628,7 @@ arm_parse_cpu (const char *str)
 	  }
 
 	if (ext != NULL)
-	  return arm_parse_extension (ext, mcpu_cpu_opt, &dyn_mcpu_ext_opt);
+	  return arm_parse_extension (ext, mcpu_cpu_opt, mcpu_ext_opt);
 
 	return TRUE;
       }
@@ -26642,11 +26659,14 @@ arm_parse_arch (const char *str)
     if (opt->name_len == len && strncmp (opt->name, str, len) == 0)
       {
 	march_cpu_opt = &opt->value;
+	if (march_ext_opt == NULL)
+	  march_ext_opt = XNEW (arm_feature_set);
+	*march_ext_opt = arm_arch_none;
 	march_fpu_opt = &opt->default_fpu;
 	strcpy (selected_cpu_name, opt->name);
 
 	if (ext != NULL)
-	  return arm_parse_extension (ext, march_cpu_opt, &dyn_march_ext_opt);
+	  return arm_parse_extension (ext, march_cpu_opt, march_ext_opt);
 
 	return TRUE;
       }
@@ -27138,26 +27158,31 @@ aeabi_set_public_attributes (void)
 	ARM_MERGE_FEATURE_SETS (flags, flags, arm_ext_v4t);
 
       /* Code run during relaxation relies on selected_cpu being set.  */
+      ARM_CLEAR_FEATURE (flags_arch, flags, fpu_any);
+      flags_ext = arm_arch_none;
+      ARM_CLEAR_FEATURE (selected_arch, flags_arch, flags_ext);
+      selected_ext = flags_ext;
       selected_cpu = flags;
     }
   /* Otherwise, choose the architecture based on the capabilities of the
      requested cpu.  */
   else
-    flags = selected_cpu;
-  ARM_MERGE_FEATURE_SETS (flags, flags, *mfpu_opt);
+    {
+      ARM_MERGE_FEATURE_SETS (flags_arch, selected_arch, selected_ext);
+      ARM_CLEAR_FEATURE (flags_arch, flags_arch, fpu_any);
+      flags_ext = selected_ext;
+      flags = selected_cpu;
+    }
+  ARM_MERGE_FEATURE_SETS (flags, flags, selected_fpu);
 
   /* Allow the user to override the reported architecture.  */
-  if (object_arch)
+  if (!ARM_FEATURE_ZERO (selected_object_arch))
     {
-      ARM_CLEAR_FEATURE (flags_arch, *object_arch, fpu_any);
+      ARM_CLEAR_FEATURE (flags_arch, selected_object_arch, fpu_any);
       flags_ext = arm_arch_none;
     }
   else
-    {
-      ARM_CLEAR_FEATURE (flags_arch, flags, fpu_any);
-      flags_ext = dyn_mcpu_ext_opt ? *dyn_mcpu_ext_opt : arm_arch_none;
-      skip_exact_match = ARM_FEATURE_EQUAL (selected_cpu, arm_arch_any);
-    }
+    skip_exact_match = ARM_FEATURE_EQUAL (selected_cpu, arm_arch_any);
 
   /* When this function is run again after relaxation has happened there is no
      way to determine whether an architecture or CPU was specified by the user:
@@ -27198,7 +27223,7 @@ aeabi_set_public_attributes (void)
     aeabi_set_attribute_int (Tag_CPU_arch_profile, profile);
 
   /* Tag_DSP_extension.  */
-  if (dyn_mcpu_ext_opt && ARM_CPU_HAS_FEATURE (*dyn_mcpu_ext_opt, arm_ext_dsp))
+  if (ARM_CPU_HAS_FEATURE (selected_ext, arm_ext_dsp))
     aeabi_set_attribute_int (Tag_DSP_extension, 1);
 
   ARM_CLEAR_FEATURE (flags_arch, flags, fpu_any);
@@ -27321,10 +27346,10 @@ void
 arm_md_post_relax (void)
 {
   aeabi_set_public_attributes ();
-  XDELETE (dyn_mcpu_ext_opt);
-  dyn_mcpu_ext_opt = NULL;
-  XDELETE (dyn_march_ext_opt);
-  dyn_march_ext_opt = NULL;
+  XDELETE (mcpu_ext_opt);
+  mcpu_ext_opt = NULL;
+  XDELETE (march_ext_opt);
+  march_ext_opt = NULL;
 }
 
 /* Add the default contents for the .ARM.attributes section.  */
@@ -27358,11 +27383,9 @@ s_arm_cpu (int ignored ATTRIBUTE_UNUSED)
   for (opt = arm_cpus + 1; opt->name != NULL; opt++)
     if (streq (opt->name, name))
       {
-	mcpu_cpu_opt = &opt->value;
-	if (!dyn_mcpu_ext_opt)
-	  dyn_mcpu_ext_opt = XNEW (arm_feature_set);
-	*dyn_mcpu_ext_opt = opt->ext;
-	ARM_MERGE_FEATURE_SETS (selected_cpu, *mcpu_cpu_opt, *dyn_mcpu_ext_opt);
+	selected_arch = opt->value;
+	selected_ext = opt->ext;
+	ARM_MERGE_FEATURE_SETS (selected_cpu, selected_arch, selected_ext);
 	if (opt->canonical_name)
 	  strcpy (selected_cpu_name, opt->canonical_name);
 	else
@@ -27373,9 +27396,8 @@ s_arm_cpu (int ignored ATTRIBUTE_UNUSED)
 
 	    selected_cpu_name[i] = 0;
 	  }
-	ARM_MERGE_FEATURE_SETS (cpu_variant, *mcpu_cpu_opt, *mfpu_opt);
-	if (dyn_mcpu_ext_opt)
-	  ARM_MERGE_FEATURE_SETS (cpu_variant, cpu_variant, *dyn_mcpu_ext_opt);
+	ARM_MERGE_FEATURE_SETS (cpu_variant, selected_cpu, selected_fpu);
+
 	*input_line_pointer = saved_char;
 	demand_empty_rest_of_line ();
 	return;
@@ -27404,12 +27426,11 @@ s_arm_arch (int ignored ATTRIBUTE_UNUSED)
   for (opt = arm_archs + 1; opt->name != NULL; opt++)
     if (streq (opt->name, name))
       {
-	mcpu_cpu_opt = &opt->value;
-	XDELETE (dyn_mcpu_ext_opt);
-	dyn_mcpu_ext_opt = NULL;
-	selected_cpu = *mcpu_cpu_opt;
+	selected_arch = opt->value;
+	selected_ext = arm_arch_none;
+	selected_cpu = selected_arch;
 	strcpy (selected_cpu_name, opt->name);
-	ARM_MERGE_FEATURE_SETS (cpu_variant, selected_cpu, *mfpu_opt);
+	ARM_MERGE_FEATURE_SETS (cpu_variant, selected_cpu, selected_fpu);
 	*input_line_pointer = saved_char;
 	demand_empty_rest_of_line ();
 	return;
@@ -27439,7 +27460,7 @@ s_arm_object_arch (int ignored ATTRIBUTE_UNUSED)
   for (opt = arm_archs + 1; opt->name != NULL; opt++)
     if (streq (opt->name, name))
       {
-	object_arch = &opt->value;
+	selected_object_arch = opt->value;
 	*input_line_pointer = saved_char;
 	demand_empty_rest_of_line ();
 	return;
@@ -27456,7 +27477,6 @@ static void
 s_arm_arch_extension (int ignored ATTRIBUTE_UNUSED)
 {
   const struct arm_option_extension_value_table *opt;
-  const arm_feature_set arm_any = ARM_ANY;
   char saved_char;
   char *name;
   int adding_value = 1;
@@ -27482,9 +27502,9 @@ s_arm_arch_extension (int ignored ATTRIBUTE_UNUSED)
 	for (i = 0; i < nb_allowed_archs; i++)
 	  {
 	    /* Empty entry.  */
-	    if (ARM_FEATURE_EQUAL (opt->allowed_archs[i], arm_any))
+	    if (ARM_CPU_IS_ANY (opt->allowed_archs[i]))
 	      continue;
-	    if (ARM_FSET_CPU_SUBSET (opt->allowed_archs[i], *mcpu_cpu_opt))
+	    if (ARM_FSET_CPU_SUBSET (opt->allowed_archs[i], selected_arch))
 	      break;
 	  }
 
@@ -27495,20 +27515,14 @@ s_arm_arch_extension (int ignored ATTRIBUTE_UNUSED)
 	    break;
 	  }
 
-	if (!dyn_mcpu_ext_opt)
-	  {
-	    dyn_mcpu_ext_opt = XNEW (arm_feature_set);
-	    *dyn_mcpu_ext_opt = arm_arch_none;
-	  }
 	if (adding_value)
-	  ARM_MERGE_FEATURE_SETS (*dyn_mcpu_ext_opt, *dyn_mcpu_ext_opt,
+	  ARM_MERGE_FEATURE_SETS (selected_ext, selected_ext,
 				  opt->merge_value);
 	else
-	  ARM_CLEAR_FEATURE (*dyn_mcpu_ext_opt, *dyn_mcpu_ext_opt,
-			     opt->clear_value);
+	  ARM_CLEAR_FEATURE (selected_ext, selected_ext, opt->clear_value);
 
-	ARM_MERGE_FEATURE_SETS (selected_cpu, *mcpu_cpu_opt, *dyn_mcpu_ext_opt);
-	ARM_MERGE_FEATURE_SETS (cpu_variant, selected_cpu, *mfpu_opt);
+	ARM_MERGE_FEATURE_SETS (selected_cpu, selected_arch, selected_ext);
+	ARM_MERGE_FEATURE_SETS (cpu_variant, selected_cpu, selected_fpu);
 	*input_line_pointer = saved_char;
 	demand_empty_rest_of_line ();
 	/* Allowing Thumb division instructions for ARMv7 in autodetection rely
@@ -27543,10 +27557,13 @@ s_arm_fpu (int ignored ATTRIBUTE_UNUSED)
   for (opt = arm_fpus; opt->name != NULL; opt++)
     if (streq (opt->name, name))
       {
-	mfpu_opt = &opt->value;
-	ARM_MERGE_FEATURE_SETS (cpu_variant, *mcpu_cpu_opt, *mfpu_opt);
-	if (dyn_mcpu_ext_opt)
-	  ARM_MERGE_FEATURE_SETS (cpu_variant, cpu_variant, *dyn_mcpu_ext_opt);
+	selected_fpu = opt->value;
+#ifndef CPU_DEFAULT
+	if (no_cpu_selected ())
+	  ARM_MERGE_FEATURE_SETS (cpu_variant, arm_arch_any, selected_fpu);
+	else
+#endif
+	  ARM_MERGE_FEATURE_SETS (cpu_variant, selected_cpu, selected_fpu);
 	*input_line_pointer = saved_char;
 	demand_empty_rest_of_line ();
 	return;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]