Why isn't it just an indirect call in the cases that would require a GOT
slot and a direct call otherwise ? I'm trying to work out what's so
different on each target that mandates this to be in the target backend.
Also it would be better to push the tests into gcc.dg if you can and check
for the absence of a relocation so that folks at least see these as being
UNSUPPORTED on their target.



To be even more explicit, shouldn't this be handled similar to the way in which -fno-plt is handled in a target agnostic manner ? After all, if you can handle this for the command line, doing the same for a function which has been decorated with attribute((noplt)) should be simple.

I am not familiar with PLT calls for other targets.  I can move the
tests to gcc.dg but what relocation are you suggesting I check for?

Move the test to gcc.dg, add a target_support_no_plt function in testsuite/lib/target-supports.exp and mark this as being supported only on x86 and use scan-assembler to scan for PLT relocations for x86. Other targets can add things as they deem fit.

In any case, on a large number of elf/ linux targets I would have thought the absence of a JMP_SLOT relocation would be good enough to check that this is working correctly.

regards
Ramana




Thanks
Sri





Ramana


Also I think the PLT calls have EBX in call fusage wich is added by
ix86_expand_call.
   else
     {
       /* Static functions and indirect calls don't need the pic
register.  */
       if (flag_pic
           && (!TARGET_64BIT
               || (ix86_cmodel == CM_LARGE_PIC
                   && DEFAULT_ABI != MS_ABI))
           && GET_CODE (XEXP (fnaddr, 0)) == SYMBOL_REF
           && ! SYMBOL_REF_LOCAL_P (XEXP (fnaddr, 0)))
         {
           use_reg (&use, gen_rtx_REG (Pmode,
REAL_PIC_OFFSET_TABLE_REGNUM));
           if (ix86_use_pseudo_pic_reg ())
             emit_move_insn (gen_rtx_REG (Pmode,
REAL_PIC_OFFSET_TABLE_REGNUM),
                             pic_offset_table_rtx);
         }

I think you want to take that away from FUSAGE there just like we do for
local calls
(and in fact the code should already check flag_pic && flag_plt I
suppose.

Done that now and patch attached.

Thanks
Sri


Honza

Reply via email to