Understanding fragP->fr_address in md_estimate_size_before_relax

Alan Modra amodra@gmail.com
Mon Apr 10 06:50:13 GMT 2023


On Sat, Apr 08, 2023 at 11:35:33PM +0200, Thomas Koenig via Binutils wrote:
> Hi,
> 
> I'm currently trying to do a binutils port of a yet-to-be-released ISA,
> and I have some trouble understanding relax.  I'm looking at RISC-V
> as an example, but I am still somewhat confused.
> 
> One point I am wondering about is the use of fragP->fr_address in
> md_estimate_size_before_relax.  Looking at the RISC-V port (which
> does relax) as an example, I see that fragp->fr_address is always zero
> on every invocation,

It should not always be zero.  fr_address starts off as zero, but
non-zero addresses will be assigned in relax_segment.  If addresses
change (which they always will) relax_seg should be called multiple
times for a given section.

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list