From: dj Date: Fri, 2 Jul 2010 20:24:22 +0000 (+0000) Subject: * config/tc-rx.c (rx_bytesT): Add grown/shrank counters for X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=4d51f188b2d5340f6debb3d03d820d36703fc109;p=pf3gnuchains%2Fpf3gnuchains4x.git * config/tc-rx.c (rx_bytesT): Add grown/shrank counters for relaxation. (rx_relax_frag): Prevent infinite loops of grow/shrink/grow/etc. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index ef3ac8b832..47708c7c4a 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2010-07-02 DJ Delorie + + * config/tc-rx.c (rx_bytesT): Add grown/shrank counters for + relaxation. + (rx_relax_frag): Prevent infinite loops of grow/shrink/grow/etc. + 2010-07-01 H.J. Lu AVX Programming Reference (June, 2010) diff --git a/gas/config/tc-rx.c b/gas/config/tc-rx.c index 3bb9a5afe7..00101e0318 100644 --- a/gas/config/tc-rx.c +++ b/gas/config/tc-rx.c @@ -624,6 +624,8 @@ typedef struct rx_bytesT int n_relax; int link_relax; fixS *link_relax_fixP; + char times_grown; + char times_shrank; } rx_bytesT; static rx_bytesT rx_bytes; @@ -1485,6 +1487,21 @@ rx_relax_frag (segT segment ATTRIBUTE_UNUSED, fragS * fragP, long stretch) break; } + /* This prevents infinite loops in align-heavy sources. */ + if (newsize < oldsize) + { + if (fragP->tc_frag_data->times_shrank > 10 + && fragP->tc_frag_data->times_grown > 10) + newsize = oldsize; + if (fragP->tc_frag_data->times_shrank < 20) + fragP->tc_frag_data->times_shrank ++; + } + else if (newsize > oldsize) + { + if (fragP->tc_frag_data->times_grown < 20) + fragP->tc_frag_data->times_grown ++; + } + fragP->fr_subtype = newsize; tprintf (" -> new %d old %d delta %d\n", newsize, oldsize, newsize-oldsize); return newsize - oldsize;