Consider this code:
.globl _non_tail, _tail
.text
.code32
_non_tail:
lcall $0x33, $_non_tail.heavensgate
ret
.code64
_non_tail.heavensgate:
# do stuff. there's 12 bytes on the stack before the first argument
lret
.code32
_tail:
pushl (%esp)
movw %cs, 4(%esp)
ljmp $0x33, $_tail.heavensgate
.code64
_tail.heavensgate:
# do stuff. there's 8 bytes on the stack before the first argument
lret
Will _tail
cause the return stack buffer to mispredict future returns? On the one hand, it's pairing a near call with a far return, but on the other hand, it's still returning to the exact same place that it would have normally.