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]

[Xtensa Patch] do_align_targets is too restrictive


Hello,

Calling do_align_targets in the big conditional inside xtensa_frob_label is too restrictive and prevents moving labels when do_align_targets is false. This can result in the wrong frag being marked a branch target if do_align_targets is false.

The better approach is to move the call inside the conditional so that the labels are moved every time, and only set the frag_type based on do_align_targets.

The enclosed patch does just that and has been working correctly in my local tree for weeks and further passes the test suite.

Thanks,

Sterling
sterling@tensilica.com


2009-08-17 Sterling Augustine <sterling@jaw.hq.tensilica.com>


	* config/tc-xtensa.c (xtensa_frob_label): move call to
	do_align_targets to set frag_type only.
diff -u -p -r1.110 tc-xtensa.c
--- config/tc-xtensa.c	22 Jun 2009 17:56:02 -0000	1.110
+++ config/tc-xtensa.c	17 Aug 2009 20:40:53 -0000
@@ -5210,16 +5210,18 @@ xtensa_frob_label (symbolS *sym)
 
   /* No target aligning in the absolute section.  */
   if (now_seg != absolute_section
-      && do_align_targets ()
       && !is_unaligned_label (sym)
       && !generating_literals)
     {
       xtensa_set_frag_assembly_state (frag_now);
 
-      frag_var (rs_machine_dependent,
-		0, (int) freq,
-		RELAX_DESIRE_ALIGN_IF_TARGET,
-		frag_now->fr_symbol, frag_now->fr_offset, NULL);
+      if (do_align_targets ())
+	frag_var (rs_machine_dependent, 0, (int) freq,
+		  RELAX_DESIRE_ALIGN_IF_TARGET, frag_now->fr_symbol,
+		  frag_now->fr_offset, NULL);
+      else
+	frag_var (rs_fill, 0, 0, frag_now->fr_subtype,
+		  frag_now->fr_symbol, frag_now->fr_offset, NULL);
       xtensa_set_frag_assembly_state (frag_now);
       xtensa_move_labels (frag_now, 0);
     }

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