Understanding fragP->fr_address in md_estimate_size_before_relax
Thomas Koenig
tkoenig@netcologne.de
Sat Apr 8 21:35:33 GMT 2023
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, which means that the calculation of the branch
length, which is done (in relaxed_branch_length)
offsetT val = S_GET_VALUE (fragp->fr_symbol) + fragp->fr_offset;
bfd_vma rvc_range = jump ? RVC_JUMP_REACH : RVC_BRANCH_REACH;
val -= fragp->fr_address + fragp->fr_fix;
...
Since fr_address appears to be zero on every invocation of
md_estimate_before_size, the size calculation seems to be
wrong as often as not.
What am I missing here? Or have I stumbled across a bug, which
is later corrected (or not)?
Best regards
Thomas
More information about the Binutils
mailing list