PR25125, relaxation chooses wrong branch size
authorAlan Modra <amodra@gmail.com>
Fri, 25 Oct 2019 09:16:24 +0000 (19:46 +1030)
committerAlan Modra <amodra@gmail.com>
Fri, 25 Oct 2019 12:49:24 +0000 (23:19 +1030)
commit37a5888387413a4b787468eff710eefebe134201
tree85003343520c718155045d0ea00437ef7b502930
parent158da0d12a7c9bb01c6d9b8d3da609a1e2561916
PR25125, relaxation chooses wrong branch size

The patch I made for PR12049 didn't test for a "negative" branch
properly.  "if (target < address)" ought to have been
"if (target < address + fragP->fr_fix)".  Rather than making that
change, this patch adds fragP->fr_fix into address earlier.  The patch
also avoids running into a bad interaction with the m68k
md_prepare_relax_scan by returning zero growth immediately, since the
adjusted target expression would result in a zero "aim".

PR gas/25125
PR gas/12049
* write.c (relax_frag): Correct calculation of delta for
positive branches where "stretch" would make the branch
negative.  Return zero immediately in that case.  Correct
TC_PCREL_ADJUST comment.
gas/ChangeLog
gas/write.c