x64: Add support for CET IBT.

Note: this is not enabled by default, look for CET in lj_arch.h
Contributed by Yuichiro Naito. #1391
This commit is contained in:
Mike Pall
2025-10-16 14:24:52 +02:00
parent 5c3254d68d
commit 25a61a1821
7 changed files with 95 additions and 10 deletions

View File

@@ -219,6 +219,17 @@
#error "macOS requires GC64 -- don't disable it"
#endif
#if (__CET__ & 1) && defined(LUAJIT_ENABLE_CET_BR)
/*
** Control-Flow Enforcement Technique (CET) indirect branch tracking (IBT).
** This is not enabled by default because it causes a notable slowdown of
** the interpreter on all x64 CPUs, whether they have CET enabled or not.
** If your toolchain enables -fcf-protection=branch by default, you need
** to build with: make XCFLAGS=-DLUAJIT_ENABLE_CET_BR
*/
#define LJ_CET_BR 1
#endif
#elif LUAJIT_TARGET == LUAJIT_ARCH_ARM
#define LJ_ARCH_NAME "arm"