https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94417

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-03-31

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
This seems to work:

diff --git a/gcc/config/i386/i386-features.c b/gcc/config/i386/i386-features.c
index 66b120d21a7..78fb373db6e 100644
--- a/gcc/config/i386/i386-features.c
+++ b/gcc/config/i386/i386-features.c
@@ -1963,7 +1963,12 @@ rest_of_insert_endbranch (void)
       && (!flag_manual_endbr
     || lookup_attribute ("cf_check",
                DECL_ATTRIBUTES (cfun->decl)))
-      && !cgraph_node::get (cfun->decl)->only_called_directly_p ())
+      && (!cgraph_node::get (cfun->decl)->only_called_directly_p ()
+    || ix86_cmodel == CM_LARGE
+    || ix86_cmodel == CM_LARGE_PIC
+    || flag_force_indirect_call
+    || (TARGET_DLLIMPORT_DECL_ATTRIBUTES
+        && DECL_DLLIMPORT_P (cfun->decl))))
     {
       /* Queue ENDBR insertion to x86_function_profiler.  */
       if (crtl->profile && flag_fentry)

Reply via email to