aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2010-07-02 20:24:23 +0000
committerDJ Delorie <dj@redhat.com>2010-07-02 20:24:23 +0000
commit44a808b1a4654298565c602cb7847ec34e0f722a (patch)
tree80163339e91297234f5bdff83d434eede1d37a28 /gas
parent38b6c3b38d9189bc02b88cb3abe6c3e6216b33ff (diff)
downloadgdb-44a808b1a4654298565c602cb7847ec34e0f722a.zip
gdb-44a808b1a4654298565c602cb7847ec34e0f722a.tar.gz
gdb-44a808b1a4654298565c602cb7847ec34e0f722a.tar.bz2
* config/tc-rx.c (rx_bytesT): Add grown/shrank counters for
relaxation. (rx_relax_frag): Prevent infinite loops of grow/shrink/grow/etc.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog6
-rw-r--r--gas/config/tc-rx.c17
2 files changed, 23 insertions, 0 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index ef3ac8b..47708c7 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,9 @@
+2010-07-02 DJ Delorie <dj@redhat.com>
+
+ * 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 <hongjiu.lu@intel.com>
AVX Programming Reference (June, 2010)
diff --git a/gas/config/tc-rx.c b/gas/config/tc-rx.c
index 3bb9a5a..00101e0 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;