1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
From 610f6f8a297e6d4b3457c46d73611edb9e46405c Mon Sep 17 00:00:00 2001
From: Peter Jung <admin@ptr1337.dev>
Date: Tue, 29 Apr 2025 11:24:31 +0200
Subject: [PATCH] CFLAGS: Set -std=gnu17 for all compilation flags
GCC15 uses C23 by default, which breaks a lot of compatibility with the
kernel and this module. Explicitly use -std=gnu17, which is what the
kernel uses across the project.
Signed-off-by: Peter Jung <admin@ptr1337.dev>
Signed-off-by: Eric Naim <dnaim@cachyos.org>
---
Kbuild | 1 +
conftest.sh | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/Kbuild b/Kbuild
index bf06edb7..6cbc79d3 100644
--- a/Kbuild
+++ b/Kbuild
@@ -82,6 +82,7 @@ $(foreach _module, $(NV_KERNEL_MODULES), \
# $(EXTRA_CFLAGS) to ccflags-y for compatibility.
#
+EXTRA_CFLAGS += -std=gnu17
EXTRA_CFLAGS += -I$(src)/common/inc
EXTRA_CFLAGS += -I$(src)
EXTRA_CFLAGS += -Wall $(DEFINES) $(INCLUDES) -Wno-cast-qual -Wno-format-extra-args
diff --git a/conftest.sh b/conftest.sh
index 20f694ec..0019e67c 100755
--- a/conftest.sh
+++ b/conftest.sh
@@ -69,7 +69,7 @@ test_header_presence() {
# NV_LINUX_FENCE_H_PRESENT, and that is either defined or undefined, in the
# output (which goes to stdout, just like the rest of this file).
- TEST_CFLAGS="-E -M $CFLAGS"
+ TEST_CFLAGS="-std=gnu17 -E -M $CFLAGS"
file="$1"
file_define=NV_`echo $file | tr '/.-' '___' | tr 'a-z' 'A-Z'`_PRESENT
@@ -94,7 +94,7 @@ test_header_presence() {
build_cflags() {
ISYSTEM=`$CC -print-file-name=include 2> /dev/null`
- BASE_CFLAGS="-O2 -D__KERNEL__ \
+ BASE_CFLAGS="-std=gnu17 -O2 -D__KERNEL__ \
-DKBUILD_BASENAME=\"#conftest$$\" -DKBUILD_MODNAME=\"#conftest$$\" \
-nostdinc -isystem $ISYSTEM \
-Wno-implicit-function-declaration -Wno-strict-prototypes"
|