diff --git a/kernel/drivers/module-nvidia340/actions.py b/kernel/drivers/module-nvidia340/actions.py
index a6ff830dae..0dded4555b 100644
--- a/kernel/drivers/module-nvidia340/actions.py
+++ b/kernel/drivers/module-nvidia340/actions.py
@@ -46,6 +46,8 @@ def setup():
shelltools.system("patch -p1 < kernel-6.5.patch")
shelltools.system("patch -p1 < kernel-6.6.patch")
shelltools.system("patch -p1 < kernel-6.8.patch")
+ shelltools.system("patch -p1 < 0017-gcc-14.patch")
+ shelltools.system("patch -p1 < 0018-gcc-15.patch")
# Our libc is TLS enabled so use TLS library
diff --git a/kernel/drivers/module-nvidia340/files/0017-gcc-14.patch b/kernel/drivers/module-nvidia340/files/0017-gcc-14.patch
new file mode 100644
index 0000000000..4d6bdd6865
--- /dev/null
+++ b/kernel/drivers/module-nvidia340/files/0017-gcc-14.patch
@@ -0,0 +1,24 @@
+diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
+--- a/kernel/conftest.sh 2024-05-10 16:44:09.219463660 +0000
++++ b/kernel/conftest.sh 2024-05-10 16:45:33.696827888 +0000
+@@ -196,7 +196,7 @@
+ }
+
+ build_cflags() {
+- BASE_CFLAGS="-O2 -D__KERNEL__ \
++ BASE_CFLAGS="-O2 -Wno-implicit-function-declaration -Wno-incompatible-pointer-types -D__KERNEL__ \
+ -DKBUILD_BASENAME=\"#conftest$$\" -DKBUILD_MODNAME=\"#conftest$$\" \
+ -nostdinc -isystem $ISYSTEM"
+
+diff -Naur a/kernel/uvm/conftest.sh b/kernel/uvm/conftest.sh
+--- a/kernel/uvm/conftest.sh 2024-05-10 16:44:09.206130218 +0000
++++ b/kernel/uvm/conftest.sh 2024-05-10 16:45:45.273592434 +0000
+@@ -196,7 +196,7 @@
+ }
+
+ build_cflags() {
+- BASE_CFLAGS="-O2 -D__KERNEL__ \
++ BASE_CFLAGS="-O2 -Wno-implicit-function-declaration -Wno-incompatible-pointer-types -D__KERNEL__ \
+ -DKBUILD_BASENAME=\"#conftest$$\" -DKBUILD_MODNAME=\"#conftest$$\" \
+ -nostdinc -isystem $ISYSTEM"
+
diff --git a/kernel/drivers/module-nvidia340/files/0018-gcc-15.patch b/kernel/drivers/module-nvidia340/files/0018-gcc-15.patch
new file mode 100644
index 0000000000..ae1c98b8e3
--- /dev/null
+++ b/kernel/drivers/module-nvidia340/files/0018-gcc-15.patch
@@ -0,0 +1,32 @@
+--- a/kernel/conftest.sh 2025-05-14 11:44:20.223439900 +0300
++++ b/kernel/conftest.sh 2025-05-14 11:44:29.546716534 +0300
+@@ -196,7 +196,7 @@
+ }
+
+ build_cflags() {
+- BASE_CFLAGS="-O2 -Wno-implicit-function-declaration -Wno-incompatible-pointer-types -D__KERNEL__ \
++ BASE_CFLAGS="-std=gnu17 -O2 -Wno-implicit-function-declaration -Wno-incompatible-pointer-types -D__KERNEL__ \
+ -DKBUILD_BASENAME=\"#conftest$$\" -DKBUILD_MODNAME=\"#conftest$$\" \
+ -nostdinc -isystem $ISYSTEM"
+
+--- a/kernel/nvidia-modules-common.mk 2025-05-14 11:44:20.176773517 +0300
++++ b/kernel/nvidia-modules-common.mk 2025-05-14 11:44:28.033392404 +0300
+@@ -116,7 +116,7 @@
+ # NVIDIA specific CFLAGS and #define's.
+ #
+
+-EXTRA_CFLAGS += -D__KERNEL__ -DMODULE -DNVRM -DNV_VERSION_STRING=\"340.108\" -Wno-unused-function -Wuninitialized -fno-strict-aliasing -mno-red-zone -mcmodel=kernel -DNV_UVM_ENABLE -D__linux__ -DNV_DEV_NAME=\"$(MODULE_NAME)\"
++EXTRA_CFLAGS += -std=gnu17 -D__KERNEL__ -DMODULE -DNVRM -DNV_VERSION_STRING=\"340.108\" -Wno-unused-function -Wuninitialized -fno-strict-aliasing -mno-red-zone -mcmodel=kernel -DNV_UVM_ENABLE -D__linux__ -DNV_DEV_NAME=\"$(MODULE_NAME)\"
+
+ #
+ # Detect SGI UV systems and apply system-specific optimizations.
+--- a/kernel/uvm/conftest.sh 2025-05-14 11:44:20.223439900 +0300
++++ b/kernel/uvm/conftest.sh 2025-05-14 11:44:28.816720973 +0300
+@@ -196,7 +196,7 @@
+ }
+
+ build_cflags() {
+- BASE_CFLAGS="-O2 -Wno-implicit-function-declaration -Wno-incompatible-pointer-types -D__KERNEL__ \
++ BASE_CFLAGS="-std=gnu17 -O2 -Wno-implicit-function-declaration -Wno-incompatible-pointer-types -D__KERNEL__ \
+ -DKBUILD_BASENAME=\"#conftest$$\" -DKBUILD_MODNAME=\"#conftest$$\" \
+ -nostdinc -isystem $ISYSTEM"
diff --git a/kernel/drivers/module-nvidia340/pspec.xml b/kernel/drivers/module-nvidia340/pspec.xml
index e5938c0933..e51ef7010f 100644
--- a/kernel/drivers/module-nvidia340/pspec.xml
+++ b/kernel/drivers/module-nvidia340/pspec.xml
@@ -32,6 +32,8 @@
0014-kernel-6.5.patch
0015-kernel-6.6.patch
0016-kernel-6.8.patch
+ 0017-gcc-14.patch
+ 0018-gcc-15.patch
kernel-module-headers