public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Thomas Koenig <tkoenig@netcologne.de>
To: binutils@sourceware.org
Subject: Understanding fragP->fr_address in md_estimate_size_before_relax
Date: Sat, 8 Apr 2023 23:35:33 +0200	[thread overview]
Message-ID: <2e4eadea-f76a-22f4-c5e1-314bc3aeaaa0@netcologne.de> (raw)

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

             reply	other threads:[~2023-04-08 21:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-08 21:35 Thomas Koenig [this message]
2023-04-10  6:50 ` Alan Modra
2023-04-10  8:40   ` Thomas Koenig
2023-04-11  2:15     ` Alan Modra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2e4eadea-f76a-22f4-c5e1-314bc3aeaaa0@netcologne.de \
    --to=tkoenig@netcologne.de \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).