x86: Add external retpoline thunk

This allows use of -mindirect-branch=thunk-extern, and is only a few
bytes of dead code if not used.

Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D60524
This commit is contained in:
Ed Maste committed 2026-10-09 10:50:40 -04:00
1 parent 81b5b2265d
commit 74d971fe15
2 files changed
+20

No files matched your search

+10
View File
@@ -1996,4 +1996,14 @@ ENTRY(cpu_sync_core)
iretq
END(cpu_sync_core)
/* External Retpoline thunk */
ENTRY(__x86_indirect_thunk_r11)
callq 2f
1: pause
lfence
jmp 1b
2: movq %r11, (%rsp)
retq
END(__x86_indirect_thunk_r11)
.section .note.GNU-stack,"",%progbits
+10
View File
@@ -587,4 +587,14 @@ ENTRY(cpu_sync_core)
iretl
END(cpu_sync_core)
/* External retpoline thunk */
ENTRY(__x86_indirect_thunk_eax)
calll 2f
1: pause
lfence
jmp 1b
2: movl %eax, (%esp)
retl
END(__x86_indirect_thunk_eax)
.section .note.GNU-stack,"",%progbits