This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
On Wed, Jun 3, 2015 at 1:09 PM, Richard Henderson <rth@redhat.com> wrote:
> On 06/03/2015 11:38 AM, Sriraman Tallam wrote:
>> + { "no_plt", 0, 0, true, false, false,
>> + handle_no_plt_attribute, false },
>
> Call it noplt. We don't add the underscore for noinline, noclone, etc.
Done.
>
>
>
>> Index: config/i386/i386.c
>> ===================================================================
>> --- config/i386/i386.c (revision 223720)
>> +++ config/i386/i386.c (working copy)
>> @@ -5479,7 +5479,10 @@ ix86_function_ok_for_sibcall (tree decl, tree exp)
>> && !TARGET_64BIT
>> && flag_pic
>> && flag_plt
>> - && decl && !targetm.binds_local_p (decl))
>> + && decl
>> + && (TREE_CODE (decl) != FUNCTION_DECL
>> + || !lookup_attribute ("no_plt", DECL_ATTRIBUTES (decl)))
>> + && !targetm.binds_local_p (decl))
>> return false;
>>
>> /* If we need to align the outgoing stack, then sibcalling would
>
> Is this really necessary? I'd expect DECL to be NULL in this case,
> since the non-use of the PLT will mean that the (sib)call is indirect.
Removed.
>
>
>> @@ -25497,13 +25500,19 @@ ix86_expand_call (rtx retval, rtx fnaddr, rtx call
>> }
>> else
>> {
>> - /* Static functions and indirect calls don't need the pic register. */
>> + /* Static functions and indirect calls don't need the pic register. Also,
>> + check if PLT was explicitly avoided via no-plt or "no_plt" attribute, making
>> + it an indirect call. */
>> 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)))
>> + && !SYMBOL_REF_LOCAL_P (XEXP (fnaddr, 0))
>> + && flag_plt
>> + && (TREE_CODE (SYMBOL_REF_DECL (XEXP(fnaddr, 0))) != FUNCTION_DECL
>> + || !lookup_attribute ("no_plt",
>> + DECL_ATTRIBUTES (SYMBOL_REF_DECL (XEXP(fnaddr, 0))))))
>> {
>> use_reg (&use, gen_rtx_REG (Pmode, REAL_PIC_OFFSET_TABLE_REGNUM));
>> if (ix86_use_pseudo_pic_reg ())
>
> Why are you testing FUNCTION_DECL? Even if, somehow, the user were producing a
> function call to a data symbol, why do you think that lookup_attribute would
> produce incorrect results?
>
> Similarly in ix86_nopic_no_plt_attribute_p.
Fixed.
Patch attached with those changes.
Thanks
Sri
Attachment:
noplt_attrib_patch_new.txt
Description: Text document
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |