@@ -75,70 +75,63 @@ $(foreach _module, $(NV_KERNEL_MODULES), \
7575 $(eval include $(src)/$(_module)/$(_module).Kbuild))
7676
7777
78- #
79- # Define CFLAGS that apply to all the NVIDIA kernel modules. EXTRA_CFLAGS
80- # is deprecated since 2.6.24 in favor of ccflags-y, but we need to support
81- # older kernels which do not have ccflags-y. Newer kernels append
82- # $(EXTRA_CFLAGS) to ccflags-y for compatibility.
83- #
84-
85- EXTRA_CFLAGS += -I$(src ) /common/inc
86- EXTRA_CFLAGS += -I$(src )
87- EXTRA_CFLAGS += -Wall $(DEFINES ) $(INCLUDES ) -Wno-cast-qual -Wno-error -Wno-format-extra-args
88- EXTRA_CFLAGS += -D__KERNEL__ -DMODULE -DNVRM
89- EXTRA_CFLAGS += -DNV_VERSION_STRING=\"535.247.01\"
78+ ccflags-y += -I$(src ) /common/inc
79+ ccflags-y += -I$(src )
80+ ccflags-y += -Wall $(DEFINES ) $(INCLUDES ) -Wno-cast-qual -Wno-format-extra-args
81+ ccflags-y += -D__KERNEL__ -DMODULE -DNVRM
82+ ccflags-y += -DNV_VERSION_STRING=\"535.261.03\"
9083
9184ifneq ($(SYSSRCHOST1X ) ,)
92- EXTRA_CFLAGS += -I$(SYSSRCHOST1X )
85+ ccflags-y += -I$(SYSSRCHOST1X )
9386endif
9487
95- EXTRA_CFLAGS += -Wno-unused-function
88+ ccflags-y += -Wno-unused-function
9689
9790ifneq ($(NV_BUILD_TYPE ) ,debug)
98- EXTRA_CFLAGS += -Wuninitialized
91+ ccflags-y += -Wuninitialized
9992endif
10093
101- EXTRA_CFLAGS += -fno-strict-aliasing
94+ ccflags-y += -fno-strict-aliasing
10295
10396ifeq ($(ARCH ) ,arm64)
104- EXTRA_CFLAGS += -mstrict-align
97+ ccflags-y += -mstrict-align
10598endif
10699
107100ifeq ($(NV_BUILD_TYPE ) ,debug)
108- EXTRA_CFLAGS += -g
109- EXTRA_CFLAGS += $(call cc-option,-gsplit-dwarf,)
101+ ccflags-y += -g
102+ ccflags-y += $(call cc-option,-gsplit-dwarf,)
110103endif
111104
112- EXTRA_CFLAGS += -ffreestanding
105+ ccflags-y += -ffreestanding
113106
114107ifeq ($(ARCH ) ,arm64)
115- EXTRA_CFLAGS += -mgeneral-regs-only -march=armv8-a
116- EXTRA_CFLAGS += $(call cc-option,-mno-outline-atomics,)
108+ ccflags-y += -mgeneral-regs-only -march=armv8-a
109+ ccflags-y += $(call cc-option,-mno-outline-atomics,)
117110endif
118111
119112ifeq ($(ARCH ) ,x86_64)
120- EXTRA_CFLAGS += -mno-red-zone -mcmodel=kernel
113+ ccflags-y += -mno-red-zone -mcmodel=kernel
121114endif
122115
123116ifeq ($(ARCH ) ,powerpc)
124- EXTRA_CFLAGS += -mlittle-endian -mno-strict-align -mno-altivec
117+ ccflags-y += -mlittle-endian -mno-strict-align -mno-altivec
125118endif
126119
127- EXTRA_CFLAGS += -DNV_UVM_ENABLE
128- EXTRA_CFLAGS += $(call cc-option,-Werror=undef,)
129- EXTRA_CFLAGS += -DNV_SPECTRE_V2=$(NV_SPECTRE_V2 )
130- EXTRA_CFLAGS += -DNV_KERNEL_INTERFACE_LAYER
120+ ccflags-y += -DNV_UVM_ENABLE
121+ ccflags-y += $(call cc-option,-Werror=undef,)
122+ ccflags-y += -DNV_SPECTRE_V2=$(NV_SPECTRE_V2 )
123+ ccflags-y += -DNV_KERNEL_INTERFACE_LAYER
131124
132125#
133126# Detect SGI UV systems and apply system-specific optimizations.
134127#
135128
136129ifneq ($(wildcard /proc/sgi_uv) ,)
137- EXTRA_CFLAGS += -DNV_CONFIG_X86_UV
130+ ccflags-y += -DNV_CONFIG_X86_UV
138131endif
139132
140133ifdef VGX_FORCE_VFIO_PCI_CORE
141- EXTRA_CFLAGS += -DNV_VGPU_FORCE_VFIO_PCI_CORE
134+ ccflags-y += -DNV_VGPU_FORCE_VFIO_PCI_CORE
142135endif
143136
144137#
@@ -165,9 +158,11 @@ NV_CONFTEST_CMD := /bin/sh $(NV_CONFTEST_SCRIPT) \
165158
166159NV_CFLAGS_FROM_CONFTEST := $(shell $(NV_CONFTEST_CMD ) build_cflags)
167160
168- NV_CONFTEST_CFLAGS = $(NV_CFLAGS_FROM_CONFTEST ) $(EXTRA_CFLAGS ) -fno-pie
161+ NV_CONFTEST_CFLAGS = $(NV_CFLAGS_FROM_CONFTEST ) $(ccflags-y ) -fno-pie
162+ NV_CONFTEST_CFLAGS += $(filter -std=% ,$(KBUILD_CFLAGS ) )
169163NV_CONFTEST_CFLAGS += $(call cc-disable-warning,pointer-sign)
170164NV_CONFTEST_CFLAGS += $(call cc-option,-fshort-wchar,)
165+ NV_CONFTEST_CFLAGS += $(call cc-option,-Werror=incompatible-pointer-types,)
171166
172167NV_CONFTEST_COMPILE_TEST_HEADERS := $(obj ) /conftest/macros.h
173168NV_CONFTEST_COMPILE_TEST_HEADERS += $(obj ) /conftest/functions.h
0 commit comments