This is the mail archive of the
mailing list for the binutils project.
Re: [PATCH][x86_64] Convert indirect call via GOT to direct when possible
- From: Cary Coutant <ccoutant at gmail dot com>
- To: Sriraman Tallam <tmsriram at google dot com>
- Cc: "H.J. Lu" <hjl dot tools at gmail dot com>, binutils <binutils at sourceware dot org>, David Li <davidxl at google dot com>
- Date: Tue, 28 Jun 2016 12:31:41 -0700
- Subject: Re: [PATCH][x86_64] Convert indirect call via GOT to direct when possible
- Authentication-results: sourceware.org; auth=none
- References: <CAAs8HmxxdBpS7w8udZgK0QFi5TnenU3wGhpPfhWeKE8Tr=thvA at mail dot gmail dot com> <CAMe9rOpk3aOK5mMkKvYQyzeQxJ-h8o+3KjLRikKSkLmMfqoUtg at mail dot gmail dot com> <CAAs8Hmw2KQ2neDNP5cnQPBVBZMJthvQGTARPiwa-NfAx5R6ugw at mail dot gmail dot com> <CAMe9rOrOyYv0+svcObyaBcoYbAWZTadEPm-mAGQUFFyNjPgctg at mail dot gmail dot com> <CAAs8HmzoxWe2YpvjviV-bs2BRotGa_WFWbCyyLh-_L=s00yxjQ at mail dot gmail dot com> <CAJimCsF4h+e_Ey-fGxPXM0h8ZJ-SmSzyP9XoYaNuEOByJSm=1A at mail dot gmail dot com> <CAAs8HmzH3qjeOSHYe_WEEdx-iuF5oGn5FwkA9vtUBV_5gO3r4w at mail dot gmail dot com> <CAJimCsEATs8PYb7FAJ43OcF07z5hjRApsAptYnvYajsn246a-A at mail dot gmail dot com> <CAAs8HmwnGgr5vVhEqGjZHEkhFYJbnUcvCWPkQj0y6zOi3ASJpQ at mail dot gmail dot com>
> Yes, good point. I am a little confused about this new relocation
> elfcpp::R_X86_64_GOTPCRELX. I have attached a patch that reverts to
> the change you suggested where I check for conversion always.
> However, is it safe to assume that a elfcpp::R_X86_64_GOTPCRELX
> relocation implies that the instruction containing the relocation is
> eligible for one of the conversions *always* ?
Here's HJ's original proposal:
It looks like that relocation marks several different instructions
sequences that are eligible for transformation, so it looks like you
may still have to look at the opcode. But it might be the case that in
Scan::global(), all we need to know is that *some* transformation is
going to happen that will remove the need for the GOT entry -- it
doesn't really matter which one.
HJ, can you clarify? If we have a GOTPCRELX relocation, what other
conditions are sufficient to guarantee that one of the proposed
translations will take place during relocation?
> If this is true, then I could completely remove
> can_convert_callq_to_direct and simplify the code a lot more.
> Otherwise, the check is needed in both places. Will
> -relax-relocations=yes in the assembler do the checks before
> converting R_X86_64_GOTPCREL to now R_X86_64_GOTPCRELX. The attached
> patch now contains a conservative check in both places to
There are other conditions in the can_convert* routines; I don't think
you can completely remove the routine.
Your latest version of the patch looks good; please go ahead and apply
it. I think for now it's safest to check the opcodes, and we can
discuss further improvements as a follow-up.