https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106671
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #3) > Basically: > void > aarch64_print_patchable_function_entry (FILE *file, > unsigned HOST_WIDE_INT > patch_area_size, > bool record_p) > { > if (cfun->machine->label_is_assembled > && aarch64_bti_enabled () > && !cgraph_node::get (cfun->decl)->only_called_directly_p ()) > > > That last check just needs to be removed as there is no way to know if the > linker will output a veneer. That only fixes the -fpatchable-function-entry= case. aarch64-bti-insert.cc needs to be fixed too: /* Since a Branch Target Exception can only be triggered by an indirect call, we exempt function that are only called directly. We also exempt functions that are already protected by Return Address Signing (PACIASP/ PACIBSP). For all other cases insert a BTI C at the beginning of the function. */ if (!cgraph_node::get (cfun->decl)->only_called_directly_p ())