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

--- Comment #6 from Richard Earnshaw <rearnsha at gcc dot gnu.org> ---
(In reply to Richard Earnshaw from comment #5)
> (In reply to D Scott Phillips from comment #2)
> > th(In reply to Andrew Pinski from comment #1)
> > > Shouldn't the linker add the BTI inside the ___veneer instead?
> > 
> > The bti instruction has to be placed at the target of the indirect branch
> > (at the top of `func` in this case) so I don't think it would be possible to
> > work around this just within the veneer.
> 
> The veneer has to be placed 'near' the target and then end with a direct
> branch instruction.  The linker should be able to work this out.

This might, of course, mean that two veneers are needed in this case, one that
can be reached from the initial branch, and one that can reach the final
target.  A direct branch will jump to the first and the second one will be
reached by an indirect jump (needing a BTI at the start).

Reply via email to