]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
PR gas/12049
authorAlan Modra <amodra@gmail.com>
Mon, 25 Oct 2010 03:03:18 +0000 (03:03 +0000)
committerAlan Modra <amodra@gmail.com>
Mon, 25 Oct 2010 03:03:18 +0000 (03:03 +0000)
* write.c (relax_frag): Don't allow forward branches to temporarily
becomde backward branches.

gas/ChangeLog
gas/write.c

index b3fb6253d614f26cd277fa50e8e7534afe2d8992..020f927956fcfa852c40c82f8d4ae33ca4b6f7bb 100644 (file)
@@ -1,3 +1,9 @@
+2010-10-25  Alan Modra  <amodra@gmail.com>
+
+       PR gas/12049
+       * write.c (relax_frag): Don't allow forward branches to temporarily
+       becomde backward branches.
+
 2010-10-23  Mark Mitchell  <mark@codesourcery.com>
 
        * config/obj-elf.c (elf_adjust_symtab): New.  Move group section
index 080216a24097f57e30d3fb69a0991c420f83540f..4b6592f7aa8c5e5ebbb3e33c068ad9f55def8c20 100644 (file)
@@ -2163,6 +2163,13 @@ relax_frag (segT segment, fragS *fragP, long stretch)
          if (stretch < 0
              || sym_frag->region == fragP->region)
            target += stretch;
+         /* If we get here we know we have a forward branch.  This
+            relax pass may have stretched previous instructions so
+            far that omitting STRETCH would make the branch
+            negative.  Don't allow this in case the negative reach is
+            large enough to require a larger branch instruction.  */
+         else if (target < address)
+           target = fragP->fr_next->fr_address + stretch;
        }
     }