On 04/05/15 17:37, Alexander Monakov wrote:
This patch introduces option -fno-plt that allows to expand calls that would
go via PLT to load the address of the function immediately at call site (which
introduces a GOT load).  Cover letter explains the motivation for this patch.

New option documentation for invoke.texi is missing from the patch; if this is
accepted I'll be happy to send a v2 with documentation added.

        * calls.c (prepare_call_address): Transform PLT call to GOT lookup and
        indirect call by forcing address into a pseudo with -fno-plt.
        * common.opt (flag_plt): New option.

Have done a quick experiment, -fno-plt doesn't work on AArch64.

it's because although this patch force the function address into register,
but the combine pass runs later combine it back as AArch64 have defined such
insn pattern.

For X86, it's not combined back. From the rtl dump, it's because the rtl pre pass has moved the address load instruction into another basic block and combine pass don't combine across basic blocks. Also, x86 backend has done some check on flag_plt in the new added ix86_nopic_noplt_attribute_p which could help generate correct insns.

What I can think of the fix on AArch64 is by restricting the call symbol under "flag_plt == true" only, so that call via register can't be combined into call
symbol direct,

Or better to prohibit combine pass for such combining? as the generic fix on combine may
fix other broken targets.

Thoughts?

Regards,
Jiong

Reply via email to