public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Cary Coutant <ccoutant@gmail.com>
To: Vladimir Radosavljevic <Vladimir.Radosavljevic@imgtec.com>
Cc: "binutils@sourceware.org" <binutils@sourceware.org>,
	"jan.smets@nokia.com" <jan.smets@nokia.com>,
		Petar Jovanovic <Petar.Jovanovic@imgtec.com>
Subject: Re: [PATCH][gold] PR 21152: Mips: Handle more relocations in relocatable link
Date: Fri, 17 Mar 2017 03:47:00 -0000	[thread overview]
Message-ID: <CAJimCsEJSbrD1Cr2OQafc5xzEgv17ZsaWpmccXeK+p_8J2OJQA@mail.gmail.com> (raw)
In-Reply-To: <3060420525346945A0ADBD567348A917EF93C7D8@BADAG02.ba.imgtec.org>

> Yes, I'm referring to the problem that you described.
> What do you think about moving these lists into the class Mips_relobj?  If I do
> that, there is no need to reimplement the whole relocate_relocs() and the same
> approach from Target::Relocate can be used (look back to the paired HI16 while
> processing a LO16).  Report if there is no matching LO16 reloc can be added at
> the end of the Target_mips::relocate_relocs for relocatable link.

If I'm reading your patch correctly, your new
relocate_special_relocatable doesn't need to look back when processing
the LO16 relocs, but does need to look forward when processing the
HI16 relocs. So the lists used by Target::Scan::local() wouldn't help
here. (Did you mean Target::Scan instead of Target::Relocate? I don't
see any need to find paired relocs in Target::Relocate.)

I did think about putting the info in Mips_relobj, but then you'll
need an ugly static_cast to convert the Sized_relobj_file* in relinfo.
But I don't think that would even help you here, since you need to
look forward. Right?

I think for now, you could go ahead and use get_lo16_rel_addend() as
you've written it, but instead of changing the function prototype,
just calculate reloc_count from what you have in relinfo, as in
Relocate::relocate().

>> I'm not happy with the potentially quadratic behavior introduced by
>> get_lo16_rel_addend(), but I guess my real issue isn't with your patch
>> so much as with the MIPS ABI itself.
>
> Relocation section is sorted so each HI16 relocation is followed immediately
> by an associated LO16 entry (there can be more than one HI16 reloc for one
> LO16), so this approach shouldn't have an impact on performance.

If this is true, you could limit the forward scan to just a single
lookahead. But wouldn't such a restriction severely constrain
optimization? (I can imagine optimizations that would separate the
HI16 and LO16 relocations by an indefinite number of instructions, and
even some that might migrate a LO16 above its paired HI16.)

I should warn you that I'll be gone for the next three weeks, with
limited access to email. Sorry we couldn't get this patch in before I
left.

You should apply for write permission to the binutils repo. Write to
overseers@sourceware.org and name me as your sponsor. Thanks for all
your work keeping the MIPS port up to date!

-cary

  reply	other threads:[~2017-03-17  3:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-10 16:52 Vladimir Radosavljevic
2017-03-15 22:18 ` Cary Coutant
2017-03-16 18:25   ` Vladimir Radosavljevic
2017-03-17  3:47     ` Cary Coutant [this message]
2017-03-21 16:14       ` Vladimir Radosavljevic
2017-03-30 13:06         ` Maciej W. Rozycki

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=CAJimCsEJSbrD1Cr2OQafc5xzEgv17ZsaWpmccXeK+p_8J2OJQA@mail.gmail.com \
    --to=ccoutant@gmail.com \
    --cc=Petar.Jovanovic@imgtec.com \
    --cc=Vladimir.Radosavljevic@imgtec.com \
    --cc=binutils@sourceware.org \
    --cc=jan.smets@nokia.com \
    /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).