Thanks for the lang/luajit port patch. It works for me on Xeon 6325P
without runtime error. I can see the endbr64 instructions at where
I expected, while I disassemble the luajit binary. I'm sure that
the IBT patch works correctly.

From: Stuart Henderson <[email protected]>
Subject: Re: lang/luajit add support of IBT for amd64
Date: Thu, 16 Oct 2025 15:57:14 +0100

> https://github.com/LuaJIT/LuaJIT/commit/25a61a182166fec06f1a1a025eb8fabbb6cf483e
> 
> please test :) if it looks good I will commit when ports reopens.
> 
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/lang/luajit/Makefile,v
> diff -u -p -r1.38 Makefile
> --- Makefile  24 Jul 2025 14:40:51 -0000      1.38
> +++ Makefile  16 Oct 2025 14:51:54 -0000
> @@ -1,6 +1,7 @@
>  # keep arch-defines.mk LUAJIT_ARCHS in sync
>  # bump ports which use PROPERTIES:Mluajit if changing
>  ONLY_FOR_ARCHS = aarch64 arm amd64 i386 powerpc
> +USE_NOBTCFI-aarch64 = Yes
>  #
>  # games/tome4 is using embedded copy of luajit
>  
> @@ -14,10 +15,10 @@ SHARED_LIBS +=    luajit-5.1 1.0 # 2.0.5
>  # changes look (because they often are not)."
>  GH_ACCOUNT = LuaJIT
>  GH_PROJECT = LuaJIT
> -GH_COMMIT =  871db2c84ecefd70a850e03a6c340214a81739f0
> +GH_COMMIT =  25a61a182166fec06f1a1a025eb8fabbb6cf483e
>  # epoch time of the commit; easiest found in ${WRKSRC}/.relver of the
>  # git-archive tar
> -V =          2.1.1753364724
> +V =          2.1.1760617492
>  
>  COMMENT =    just-in-time compiler for Lua
>  DISTNAME =   LuaJIT-${V}
> @@ -30,8 +31,6 @@ HOMEPAGE =  https://luajit.org/
>  # MIT
>  PERMIT_PACKAGE =     Yes
>  
> -USE_NOBTCFI =        Yes
> -
>  WANTLIB =    c m
>  
>  MODULES =    lang/lua
> @@ -48,6 +47,10 @@ MAKE_FLAGS += \
>       INSTALL_SONAME=libluajit-5.1.so.${LIBluajit-5.1_VERSION} \
>       PREFIX="${PREFIX}" \
>       Q= E=@:
> +
> +.if ${MACHINE_ARCH} == amd64
> +CFLAGS +=    -DLUAJIT_ENABLE_CET_BR
> +.endif
>  
>  USE_GMAKE =  Yes
>  
> Index: distinfo
> ===================================================================
> RCS file: /cvs/ports/lang/luajit/distinfo,v
> diff -u -p -r1.12 distinfo
> --- distinfo  24 Jul 2025 14:40:51 -0000      1.12
> +++ distinfo  16 Oct 2025 14:51:54 -0000
> @@ -1,2 +1,2 @@
> -SHA256 (LuaJIT-2.1.1753364724-871db2c8.tar.gz) = 
> qz8W2C32lGVDVlz7DSgQ04fXmjpD4EMWlbA0ZhiOJoA=
> -SIZE (LuaJIT-2.1.1753364724-871db2c8.tar.gz) = 1084103
> +SHA256 (LuaJIT-2.1.1760617492-25a61a18.tar.gz) = 
> P8ortQaNcVDTJKNOqsVVdXuM6U8VVl4KBVI3P3U0CB4=
> +SIZE (LuaJIT-2.1.1760617492-25a61a18.tar.gz) = 1084654
> Index: patches/patch-src_Makefile
> ===================================================================
> RCS file: /cvs/ports/lang/luajit/patches/patch-src_Makefile,v
> diff -u -p -r1.10 patch-src_Makefile
> --- patches/patch-src_Makefile        29 Apr 2025 15:19:06 -0000      1.10
> +++ patches/patch-src_Makefile        16 Oct 2025 14:51:54 -0000
> @@ -1,8 +1,8 @@
>  Index: src/Makefile
>  --- src/Makefile.orig
>  +++ src/Makefile
> -@@ -357,6 +357,10 @@ else
> -   ifeq (GNU/kFreeBSD,$(TARGET_SYS))
> +@@ -360,6 +360,10 @@ else
> +   ifeq (GNU,$(TARGET_SYS))
>       TARGET_XLIBS+= -ldl
>     endif
>  +  ifeq (OpenBSD,$(TARGET_SYS))
> @@ -12,7 +12,7 @@ Index: src/Makefile
>   endif
>   endif
>   endif
> -@@ -614,10 +618,10 @@ endif
> +@@ -621,10 +625,10 @@ endif
>   endif
>   endif
>   
> Index: patches/patch-src_lj_arch_h
> ===================================================================
> RCS file: /cvs/ports/lang/luajit/patches/patch-src_lj_arch_h,v
> diff -u -p -r1.8 patch-src_lj_arch_h
> --- patches/patch-src_lj_arch_h       16 May 2024 11:04:08 -0000      1.8
> +++ patches/patch-src_lj_arch_h       16 Oct 2025 14:51:54 -0000
> @@ -5,7 +5,7 @@ ignore the gcc version check ifdef hell 
>  Index: src/lj_arch.h
>  --- src/lj_arch.h.orig
>  +++ src/lj_arch.h
> -@@ -446,7 +446,7 @@
> +@@ -460,7 +460,7 @@
>   /* -- Checks for requirements --------------------------------------------- 
> */
>   
>   /* Check for minimum required compiler versions. */

-- 
Yuichiro NAITO ([email protected])

Reply via email to