git: 1587486a39ec - main - x11/nvidia-kmod{-devel}: Export required symbols

From: Kevin Bowling <kbowling_at_FreeBSD.org>
Date: Sat, 03 Jan 2026 10:35:08 UTC
The branch main has been updated by kbowling:

URL: https://cgit.FreeBSD.org/ports/commit/?id=1587486a39ecf579cc59f878a75faef823441e2b

commit 1587486a39ecf579cc59f878a75faef823441e2b
Author:     Tomoaki AOKI <junchoon@dec.sakura.ne.jp>
AuthorDate: 2026-01-03 10:30:29 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-01-03 10:30:29 +0000

    x11/nvidia-kmod{-devel}: Export required symbols
    
    When kernel linker disables local symbol resolution, kernel modules
    that require local symbols in other kernel modules, which are not
    explicitly exported, stops to be loaded.
    
    This behavior was turned on by default on main branch of src
    at commit base 9562994a7aacee2baae6ddee1a7b558b48ae39ef.
    
    Export local symbols in nvidia.ko for nvidia-modeset.ko and
    in nvidia-modeset.ko for nvidia-drm.ko.
    
    PR:             291212
    Reviewed by:    adrian (previous version), emaste (previous version, imp
    Differential Revision:  https://reviews.freebsd.org/D53987
---
 x11/nvidia-driver/files/extra-patch-src-Makefile-2.in | 18 ++++++++++++++++++
 x11/nvidia-kmod-devel/Makefile                        |  2 +-
 x11/nvidia-kmod/Makefile                              | 12 +++++++++++-
 3 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/x11/nvidia-driver/files/extra-patch-src-Makefile-2.in b/x11/nvidia-driver/files/extra-patch-src-Makefile-2.in
new file mode 100644
index 000000000000..f75ef58ff8f0
--- /dev/null
+++ b/x11/nvidia-driver/files/extra-patch-src-Makefile-2.in
@@ -0,0 +1,18 @@
+--- src/%%NVSRC%%/Makefile.orig
++++ src/%%NVSRC%%/Makefile
+@@ -41,5 +41,14 @@
+ clean:
+ 	@rm -f ${CLEANFILES:S/${RMOBJ}//}
+ 	@rm -f stdarg.h
++
++EXPORT_SYMS=	nv_kthread_q_flush \
++		nv_kthread_q_init \
++		nv_kthread_q_init_on_node \
++		nv_kthread_q_item_init \
++		nv_kthread_q_run_self_test \
++		nv_kthread_q_schedule_q_item \
++		nv_kthread_q_stop \
++		nv_kthread_task_callback
+ 
+ .include <bsd.kmod.mk>
+
diff --git a/x11/nvidia-kmod-devel/Makefile b/x11/nvidia-kmod-devel/Makefile
index bde59cd83005..9b98a7f9d3c5 100644
--- a/x11/nvidia-kmod-devel/Makefile
+++ b/x11/nvidia-kmod-devel/Makefile
@@ -1,6 +1,6 @@
 DISTVERSION?=	590.48.01
 # Explicitly set PORTREVISION as it can be overridden by the master port
-PORTREVISION=	0
+PORTREVISION=	1
 
 MASTERDIR=	${.CURDIR}/../nvidia-kmod
 PKGNAMESUFFIX=	-devel
diff --git a/x11/nvidia-kmod/Makefile b/x11/nvidia-kmod/Makefile
index 983ec63c0c2f..b4e1c9f45f9c 100644
--- a/x11/nvidia-kmod/Makefile
+++ b/x11/nvidia-kmod/Makefile
@@ -14,7 +14,7 @@
 PORTNAME?=	nvidia-kmod
 DISTVERSION?=	${NVIDIA_DISTVERSION}
 # Always try to set PORTREVISION as it can be overridden by the slave ports
-PORTREVISION?=	0
+PORTREVISION?=	1
 CATEGORIES=	x11
 MASTER_SITES=	NVIDIA/XFree86/FreeBSD-${ARCH_SUFX}/${DISTVERSION}
 DISTNAME=	NVIDIA-FreeBSD-${ARCH_SUFX}-${DISTVERSION}
@@ -60,6 +60,16 @@ SUB_PATCHES+=	extra-patch-src-nvidia_dev.c \
 SUB_PATCHES+=	extra-patch-src-nvidia_subr.c
 .endif
 
+# At commit 9562994a7aacee2baae6ddee1a7b558b48ae39ef on main,
+# Local sym resolution was disabled by default in kernel linker.
+# Explicitly export functions from nvidia.ko to make nvidia-drm-*-kmod
+# ports work after the commit. These symbols do not exist in legacy
+# versions prior to 580 series.
+
+.if ${NVVERSION} >= 580.00000
+SUB_PATCHES+=	extra-patch-src-Makefile-2
+.endif
+
 # Temporarily disable GSP firmware as it is known to cause
 # issues with suspend/resume
 .if ${NVVERSION} >= 565.00000