public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Richard Sandiford <rsandifo@redhat.com>
To: "Maciej W. Rozycki" <macro@linux-mips.org>
Cc: binutils@sources.redhat.com
Subject: Re: [patch] MIPS: Use the right offset for LO16 in add_got_offset_hilo() (ping)
Date: Mon, 28 Feb 2005 10:27:00 -0000	[thread overview]
Message-ID: <87ekf2cby9.fsf@firetop.home> (raw)
In-Reply-To: <Pine.LNX.4.61L.0502242005470.23589@blysk.ds.pg.gda.pl> (Maciej W. Rozycki's message of "Thu, 24 Feb 2005 20:06:36 +0000 (GMT)")

"Maciej W. Rozycki" <macro@linux-mips.org> writes:
> @@ -4104,7 +4104,9 @@ add_got_offset_hilo (int dest, expressio
>    mips_optimize = 2;
>    macro_build_lui (&global, tmp);
>    mips_optimize = hold_mips_optimize;
> +  local->X_add_number = ((local->X_add_number + 0x8000) & 0xffff) - 0x8000;
>    macro_build (local, ADDRESS_ADDI_INSN, "t,r,j", tmp, tmp, BFD_RELOC_LO16);
> +  local->X_add_number = global.X_add_number;
>    relax_end ();
>  
>    macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", dest, dest, tmp);

You asked about this patch in the other thread, so FWIW, I agree that
it does the right thing.  Obviously I can't approve it though.

My main concern is that it seems to leave things in a slightly
inconsistent state.  In the case of load_got_offset, it's the caller
that adjusts the GOT16 offset:

	      expr1.X_add_number = offset_expr.X_add_number;
	      offset_expr.X_add_number =
		((offset_expr.X_add_number + 0x8000) & 0xffff) - 0x8000;
	      load_got_offset (tempreg, &offset_expr);
	      offset_expr.X_add_number = expr1.X_add_number;

whereas the patch makes the callee adjust the LO16 offset.  I had to
stare at the patch for a while before realising that the new code is
compensating for an adjustment made by the _caller_ of load_got_offset,
not load_got_offset itself.

I agree that hiding this adjustment in add_got_offset_hilo is the right
way to go.  However, it might be better to move the offset_expr adjustment
into load_got_offset at the same time.

Richard

      parent reply	other threads:[~2005-02-27 14:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-24 22:31 Maciej W. Rozycki
2005-02-26  9:40 ` Eric Christopher
2005-02-28 10:27 ` Richard Sandiford [this message]

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=87ekf2cby9.fsf@firetop.home \
    --to=rsandifo@redhat.com \
    --cc=binutils@sources.redhat.com \
    --cc=macro@linux-mips.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).