public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Understanding fragP->fr_address in md_estimate_size_before_relax
@ 2023-04-08 21:35 Thomas Koenig
  2023-04-10  6:50 ` Alan Modra
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Koenig @ 2023-04-08 21:35 UTC (permalink / raw)
  To: binutils

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-04-11  2:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-08 21:35 Understanding fragP->fr_address in md_estimate_size_before_relax Thomas Koenig
2023-04-10  6:50 ` Alan Modra
2023-04-10  8:40   ` Thomas Koenig
2023-04-11  2:15     ` Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).