"H.J. Lu" hjl.tools@gmail.com writes:
Here is the updated patch.
This V3 patch looks pretty nice to me.
But I'm a bit confused by the use of ASM_X86_ENDBR. The instruction is added to entry points, via the PROLOGUE macro, but not to other branch targets, e.g., loop labels in the assembly files. Is that not needed (because branches are direct, without going via PLT indirection)? Or will the assembler insert some ENDBR instructions automatically?
Regards, /Niels
On Thu, 2020-03-12 at 21:53 +0100, Niels Möller wrote:
"H.J. Lu" hjl.tools@gmail.com writes:
Here is the updated patch.
This V3 patch looks pretty nice to me.
But I'm a bit confused by the use of ASM_X86_ENDBR. The instruction is added to entry points, via the PROLOGUE macro, but not to other branch targets, e.g., loop labels in the assembly files. Is that not needed (because branches are direct, without going via PLT indirection)? Or will the assembler insert some ENDBR instructions automatically?
Hi Niels, ENDBR is only needed at CALL targets or indirect jump targets, so not needed for direct call. Actually theoretical harmful to add any ENDBR you do not need, as you give more landing sites.
Simo.
Simo Sorce simo@redhat.com writes:
On Thu, 2020-03-12 at 21:53 +0100, Niels Möller wrote:
But I'm a bit confused by the use of ASM_X86_ENDBR. The instruction is added to entry points, via the PROLOGUE macro, but not to other branch targets, e.g., loop labels in the assembly files. Is that not needed (because branches are direct, without going via PLT indirection)? Or will the assembler insert some ENDBR instructions automatically?
ENDBR is only needed at CALL targets or indirect jump targets, so not needed for direct call. Actually theoretical harmful to add any ENDBR you do not need, as you give more landing sites.
Thanks for the explanation. Patch merged to master now.
Regards, /Niels
nettle-bugs@lists.lysator.liu.se