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: PR gas/12698 fails to build with march=all on arm


Hi,

For PR gas/12698, Nick had fixed part of it:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/config/tc-arm.c.diff?cvsroot=src&r1=1.490&r2=1.491.
But we still get error when compiling arm kernel. Refer
http://sourceware.org/bugzilla/show_bug.cgi?id=12698 for more detail.

Here is a patch to fix do_t_mrs and do_t_msr. OK for trunk?

Thanks!
-Zhenqiang

2012-06-12  Zhenqiang Chen  <zhenqiang.chen@linaro.org>

	PR gas/12698
	*config/tc-arm.c (do_t_mrs, do_t_msr): Apply the constraint only
	for M profile when assembling for any architecture.


diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 6ff64a6..7f69ffa 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -11201,8 +11201,14 @@ do_t_mrs (void)
       int flags = inst.operands[1].imm & (PSR_c|PSR_x|PSR_s|PSR_f|SPSR_BIT);

       if (ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_m))
-	constraint (flags != 0, _("selected processor does not support "
-        	    "requested special purpose register"));
+	{
+	  /* PR gas/12698:  The constraint is only applied for m_profile.
+	     If the user has specified -march=all, we want to ignore it as
+	     we are building for any CPU type, including non-m variants.  */
+	  bfd_boolean m_profile = selected_cpu.core != arm_arch_any.core;
+	  constraint ((flags != 0) && m_profile, _("selected processor does "
+        	      "not support requested special purpose register"));
+	}
       else
 	/* mrs only accepts APSR/CPSR/SPSR/CPSR_all/SPSR_all (for non-M profile
 	   devices).  */
@@ -11235,11 +11241,14 @@ do_t_msr (void)
   if (ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_m))
     {
       int bits = inst.operands[0].imm & (PSR_c|PSR_x|PSR_s|PSR_f|SPSR_BIT);
-
-      constraint ((ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_v6_dsp)
+      /* PR gas/12698:  The constraint is only applied for m_profile.
+         If the user has specified -march=all, we want to ignore it as
+         we are building for any CPU type, including non-m variants.  */
+      bfd_boolean m_profile = selected_cpu.core != arm_arch_any.core;
+      constraint (((ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_v6_dsp)
 		   && (bits & ~(PSR_s | PSR_f)) != 0)
 		  || (!ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_v6_dsp)
-		      && bits != PSR_f),
+		      && bits != PSR_f)) && m_profile,
 		  _("selected processor does not support requested special "
 		    "purpose register"));
     }


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