aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2010-10-25 03:03:18 +0000
committerAlan Modra <amodra@gmail.com>2010-10-25 03:03:18 +0000
commite5940dffc561e32e0fa15b964a33aa3a7477237f (patch)
tree4f858d4004d85e5a1e153d2b5fd666305d00fe5f /gas
parent4073872ae32047a09f2c417fbb060df58bdef6e4 (diff)
downloadgdb-e5940dffc561e32e0fa15b964a33aa3a7477237f.zip
gdb-e5940dffc561e32e0fa15b964a33aa3a7477237f.tar.gz
gdb-e5940dffc561e32e0fa15b964a33aa3a7477237f.tar.bz2
PR gas/12049
* write.c (relax_frag): Don't allow forward branches to temporarily becomde backward branches.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog6
-rw-r--r--gas/write.c7
2 files changed, 13 insertions, 0 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index b3fb625..020f927 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -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
diff --git a/gas/write.c b/gas/write.c
index 080216a..4b6592f 100644
--- a/gas/write.c
+++ b/gas/write.c
@@ -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;
}
}