This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
fix added frag address
- From: Alan Modra <amodra at gmail dot com>
- To: binutils at sourceware dot org
- Date: Tue, 19 Oct 2010 22:45:19 +1030
- Subject: fix added frag address
An inconsequential bug I noticed when looking at PR 12049.
* write.c (relax_segment): Correct address on frag added to stop
leb128/align frags bouncing.
Index: gas/write.c
===================================================================
RCS file: /cvs/src/src/gas/write.c,v
retrieving revision 1.133
diff -u -p -r1.133 write.c
--- gas/write.c 19 Oct 2010 11:59:18 -0000 1.133
+++ gas/write.c 19 Oct 2010 12:01:22 -0000
@@ -2525,6 +2525,7 @@ relax_segment (struct frag *segment_frag
fragP->fr_literal + fragP->fr_fix,
fragP->fr_var);
newf->fr_type = rs_fill;
+ newf->fr_address = address + fragP->fr_fix + newoff;
newf->fr_fix = 0;
newf->fr_offset = (((offsetT) 1 << fragP->fr_offset)
/ fragP->fr_var);
@@ -2534,13 +2535,11 @@ relax_segment (struct frag *segment_frag
newf->fr_offset = (offsetT) 1 << fragP->fr_offset;
newf->fr_var = 1;
}
- /* Include growth of new frag, because rs_fill
- frags don't normally grow. */
+ /* Include size of new frag in GROWTH. */
growth += newf->fr_offset * newf->fr_var;
- /* The new frag address is newoff. Adjust this
- for the amount we'll add when we process the
- new frag. */
- newf->fr_address = newoff - stretch - growth;
+ /* Adjust the new frag address for the amount
+ we'll add when we process the new frag. */
+ newf->fr_address -= stretch + growth;
newf->relax_marker ^= 1;
fragP->fr_next = newf;
#ifdef DEBUG
--
Alan Modra
Australia Development Lab, IBM