On Fri, 2020-04-17 at 08:18 -0700, H.J. Lu wrote:
> On Wed, Apr 8, 2020 at 9:41 AM Jeff Law <l...@redhat.com> wrote:
> > On Wed, 2020-04-08 at 09:23 -0700, H.J. Lu wrote:
> > > On Wed, Apr 8, 2020 at 9:16 AM Jeff Law <l...@redhat.com> wrote:
> > > > On Tue, 2020-03-31 at 08:11 -0700, H.J. Lu via Gcc-patches wrote:
> > > > > Since constant_call_address_operand has
> > > > > 
> > > > > ;; Test for a pc-relative call operand
> > > > > (define_predicate "constant_call_address_operand"
> > > > >   (match_code "symbol_ref")
> > > > > {
> > > > >   if (ix86_cmodel == CM_LARGE || ix86_cmodel == CM_LARGE_PIC
> > > > >       || flag_force_indirect_call)
> > > > >     return false;
> > > > >   if (TARGET_DLLIMPORT_DECL_ATTRIBUTES && SYMBOL_REF_DLLIMPORT_P (op))
> > > > >     return false;
> > > > >   return true;
> > > > > })
> > > > > 
> > > > > even if cgraph_node::get (cfun->decl)->only_called_directly_p ()
> > > > > returns
> > > > > false, the fuction may still be called indirectly.  Copy the logic 
> > > > > from
> > > > > constant_call_address_operand to rest_of_insert_endbranch to insert
> > > > > ENDBR
> > > > > at function entry if function will be called indirectly.
> > > > > 
> > > > > gcc/
> > > > > 
> > > > >       PR target/94417
> > > > >       * config/i386/i386-features.c (rest_of_insert_endbranch): Insert
> > > > >       ENDBR at function entry if function will be called indirectly.
> > > > Can you just call constant_call_address_operand rather than copying its
> > > > contents?
> > > 
> > > I wish I could.  constant_call_address_operand uses SYMBOL_REF_DLLIMPORT_P
> > > (op)
> > > But I need to use DECL_DLLIMPORT_P (cfun->decl)).
> > Sigh.  In that case I guess the patch is OK as-is.
> > 
> 
> I'd like to backport this wrong code fix to GCC 9/8 branches.
> Is it OK for GCC 9/8 branches?
Sure.
jeff

Reply via email to