@@ -75,70 +75,63 @@ $(foreach _module, $(NV_KERNEL_MODULES), \
75
75
$(eval include $(src)/$(_module)/$(_module).Kbuild))
76
76
77
77
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\"
90
83
91
84
ifneq ($(SYSSRCHOST1X ) ,)
92
- EXTRA_CFLAGS += -I$(SYSSRCHOST1X )
85
+ ccflags-y += -I$(SYSSRCHOST1X )
93
86
endif
94
87
95
- EXTRA_CFLAGS += -Wno-unused-function
88
+ ccflags-y += -Wno-unused-function
96
89
97
90
ifneq ($(NV_BUILD_TYPE ) ,debug)
98
- EXTRA_CFLAGS += -Wuninitialized
91
+ ccflags-y += -Wuninitialized
99
92
endif
100
93
101
- EXTRA_CFLAGS += -fno-strict-aliasing
94
+ ccflags-y += -fno-strict-aliasing
102
95
103
96
ifeq ($(ARCH ) ,arm64)
104
- EXTRA_CFLAGS += -mstrict-align
97
+ ccflags-y += -mstrict-align
105
98
endif
106
99
107
100
ifeq ($(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,)
110
103
endif
111
104
112
- EXTRA_CFLAGS += -ffreestanding
105
+ ccflags-y += -ffreestanding
113
106
114
107
ifeq ($(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,)
117
110
endif
118
111
119
112
ifeq ($(ARCH ) ,x86_64)
120
- EXTRA_CFLAGS += -mno-red-zone -mcmodel=kernel
113
+ ccflags-y += -mno-red-zone -mcmodel=kernel
121
114
endif
122
115
123
116
ifeq ($(ARCH ) ,powerpc)
124
- EXTRA_CFLAGS += -mlittle-endian -mno-strict-align -mno-altivec
117
+ ccflags-y += -mlittle-endian -mno-strict-align -mno-altivec
125
118
endif
126
119
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
131
124
132
125
#
133
126
# Detect SGI UV systems and apply system-specific optimizations.
134
127
#
135
128
136
129
ifneq ($(wildcard /proc/sgi_uv) ,)
137
- EXTRA_CFLAGS += -DNV_CONFIG_X86_UV
130
+ ccflags-y += -DNV_CONFIG_X86_UV
138
131
endif
139
132
140
133
ifdef VGX_FORCE_VFIO_PCI_CORE
141
- EXTRA_CFLAGS += -DNV_VGPU_FORCE_VFIO_PCI_CORE
134
+ ccflags-y += -DNV_VGPU_FORCE_VFIO_PCI_CORE
142
135
endif
143
136
144
137
#
@@ -165,9 +158,11 @@ NV_CONFTEST_CMD := /bin/sh $(NV_CONFTEST_SCRIPT) \
165
158
166
159
NV_CFLAGS_FROM_CONFTEST := $(shell $(NV_CONFTEST_CMD ) build_cflags)
167
160
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 ) )
169
163
NV_CONFTEST_CFLAGS += $(call cc-disable-warning,pointer-sign)
170
164
NV_CONFTEST_CFLAGS += $(call cc-option,-fshort-wchar,)
165
+ NV_CONFTEST_CFLAGS += $(call cc-option,-Werror=incompatible-pointer-types,)
171
166
172
167
NV_CONFTEST_COMPILE_TEST_HEADERS := $(obj ) /conftest/macros.h
173
168
NV_CONFTEST_COMPILE_TEST_HEADERS += $(obj ) /conftest/functions.h
0 commit comments