[binutils-gdb] arm: adjust FPU selection logic

Richard Earnshaw rearnsha@sourceware.org
Wed Jun 5 16:46:53 GMT 2024


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=be9943151aba8d283b81bdc95a8b2ffa5b1d0f1a

commit be9943151aba8d283b81bdc95a8b2ffa5b1d0f1a
Author: Richard Earnshaw <rearnsha@arm.com>
Date:   Tue Jun 4 12:56:21 2024 +0100

    arm: adjust FPU selection logic
    
    The logic here seems to be overly complex, so simplify it a bit.  One
    particular problem was that using the legacy -mno-fpu option was not
    working properly, as this has all the feature bits set to zero causing
    the code to then pick a different FPU as the default.  Fix this by
    only selecting an FPU as a fallback if the code has not otherwise
    selected one: there was only one route by which this could happen.
    
    This patch is really a pre-cursor to the following one where we want
    to make no-fpu internally a fall-back position for some legacy
    processors where previously we would have dropped back to the FPA.

Diff:
---
 gas/config/tc-arm.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 8452ea17a02..9294619e1a4 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -187,7 +187,6 @@ static const arm_feature_set fpu_arch_vfp_v1 ATTRIBUTE_UNUSED = FPU_ARCH_VFP_V1;
 static const arm_feature_set fpu_arch_vfp_v2 = FPU_ARCH_VFP_V2;
 static const arm_feature_set fpu_arch_vfp_v3 ATTRIBUTE_UNUSED = FPU_ARCH_VFP_V3;
 static const arm_feature_set fpu_arch_neon_v1 ATTRIBUTE_UNUSED = FPU_ARCH_NEON_V1;
-static const arm_feature_set fpu_arch_fpa = FPU_ARCH_FPA;
 static const arm_feature_set fpu_any_hard = FPU_ANY_HARD;
 static const arm_feature_set fpu_endian_pure = FPU_ARCH_ENDIAN_PURE;
 
@@ -30817,19 +30816,13 @@ md_begin (void)
 	selected_fpu = *mcpu_fpu_opt;
       else if (march_fpu_opt)
 	selected_fpu = *march_fpu_opt;
+      else
+	selected_fpu = fpu_default;
 #else
       selected_fpu = fpu_default;
 #endif
     }
 
-  if (ARM_FEATURE_ZERO (selected_fpu))
-    {
-      if (!no_cpu_selected ())
-	selected_fpu = fpu_default;
-      else
-	selected_fpu = fpu_arch_fpa;
-    }
-
 #ifdef CPU_DEFAULT
   if (ARM_FEATURE_ZERO (selected_arch))
     {


More information about the Binutils-cvs mailing list