This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Expand PIC calls without PLT with -fno-plt
- From: Alexander Monakov <amonakov at ispras dot ru>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Jeff Law <law at redhat dot com>, gcc-patches at gcc dot gnu dot org, Rich Felker <dalias at libc dot org>
- Date: Wed, 6 May 2015 19:43:58 +0300 (MSK)
- Subject: Re: [PATCH] Expand PIC calls without PLT with -fno-plt
- Authentication-results: sourceware.org; auth=none
- References: <1430757479-14241-1-git-send-email-amonakov at ispras dot ru> <1430757479-14241-6-git-send-email-amonakov at ispras dot ru> <5547AD8D dot 9080806 at redhat dot com> <20150504173955 dot GE1751 at tucnak dot redhat dot com> <5547AF7C dot 9030500 at redhat dot com> <alpine dot LNX dot 2 dot 11 dot 1505061730460 dot 22867 at monopod dot intra dot ispras dot ru> <20150506154554 dot GZ1751 at tucnak dot redhat dot com>
On Wed, 6 May 2015, Jakub Jelinek wrote:
> The linker would know very well what kind of relocations are used for
> particular PLT slot, and for the new relocations which would resolve to the
> address of the .got.plt slot it could just tweak corresponding 3rd insn
> in the slot, to not jump to first plt slot - 16, but a few bytes before that
> that would just load the address of _G_O_T_ into %ebx and then fallthru
> into the 0x4c2b7310 snippet above. The lazy binding would be a few ticks
> slower in that case, but no requirement on %ebx to contain _G_O_T_.
No, %ebx is callee-saved, so you can't outright overwrite it in the PLT stub.
Alexander