1
1
# SPDX-License-Identifier: GPL-2.0
2
2
3
- obj-$(CONFIG_RUST) += core.o compiler_builtins.o helpers.o
3
+ obj-$(CONFIG_RUST) += core.o compiler_builtins.o
4
4
always-$(CONFIG_RUST) += exports_core_generated.h
5
5
6
+ # Missing prototypes are expected in the helpers since these are exported
7
+ # for Rust only, thus there is no header nor prototypes.
8
+ obj-$(CONFIG_RUST) += helpers.o
9
+ CFLAGS_REMOVE_helpers.o = -Wmissing-prototypes
10
+
6
11
always-$(CONFIG_RUST) += libmacros.so
7
12
no-clean-files += libmacros.so
8
13
@@ -200,15 +205,13 @@ bindgen_skip_c_flags := -mno-fp-ret-in-387 -mpreferred-stack-boundary=% \
200
205
-mindirect-branch=thunk-extern -mindirect-branch-register -mrecord-mcount \
201
206
-mabi=lp64 -mstack-protector-guard% -mtraceback=no \
202
207
-mno-pointers-to-nested-functions -mno-string -mno-strict-align \
208
+ -mstrict-align \
203
209
-fconserve-stack -falign-jumps=% -falign-loops=% \
204
210
-femit-struct-debug-baseonly -fno-ipa-cp-clone -fno-ipa-sra \
205
211
-fno-partial-inlining -fplugin-arg-arm_ssp_per_task_plugin-% \
206
212
-fno-reorder-blocks -fno-allow-store-data-races -fasan-shadow-offset=% \
207
- -Wno-packed-not-aligned -Wno-format-truncation -Wno-format-overflow \
208
- -Wno-stringop-truncation -Wno-unused-but-set-variable \
209
- -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized \
210
- -Werror=designated-init -Wno-zero-length-bounds -Wimplicit-fallthrough=% \
211
- -Wno-alloc-size-larger-than -Wcast-function-type \
213
+ -fzero-call-used-regs=% -fno-stack-clash-protection \
214
+ -fno-inline-functions-called-once \
212
215
--param=% --param asan-%
213
216
214
217
# Derived from `scripts/Makefile.clang`
@@ -219,9 +222,11 @@ BINDGEN_TARGET_riscv := riscv64-linux-gnu
219
222
BINDGEN_TARGET_x86 := x86_64-linux-gnu
220
223
BINDGEN_TARGET := $(BINDGEN_TARGET_$(SRCARCH ) )
221
224
222
- bindgen_extra_c_flags = --target=$(BINDGEN_TARGET ) \
223
- -Wno-address-of-packed-member \
224
- -Wno-gnu-variable-sized-type-not-at-end
225
+ # All warnings are inhibited since GCC builds are very experimental,
226
+ # many GCC warnings are not supported by Clang, they may only appear in
227
+ # some configurations, with new GCC versions, etc.
228
+ bindgen_extra_c_flags = -w --target=$(BINDGEN_TARGET )
229
+
225
230
bindgen_c_flags = $(filter-out $(bindgen_skip_c_flags ) , $(c_flags ) ) \
226
231
$(bindgen_extra_c_flags )
227
232
endif
@@ -253,9 +258,11 @@ quiet_cmd_bindgen_helper = BINDGEN $@
253
258
--use-core --with-derive-default --ctypes-prefix c_types \
254
259
--no-debug '.*' \
255
260
--size_t-is-usize -o $@ -- $(bindgen_c_flags_final ) \
256
- -I$(objtree ) /rust/ -DMODULE; \
261
+ -I$(objtree ) /rust/ -DMODULE $( bindgen_target_cflags ) ; \
257
262
sed -Ei 's/pub fn rust_helper_([a-zA-Z0-9_]*)/\# [link_name="rust_helper_\1"]\n pub fn \1/g' $@
258
263
264
+ # See `CFLAGS_REMOVE_helpers.o` above.
265
+ $(objtree ) /rust/bindings_helpers_generated.rs : private bindgen_target_cflags = -Wno-missing-prototypes
259
266
$(objtree ) /rust/bindings_helpers_generated.rs : $(srctree ) /rust/helpers.c FORCE
260
267
$(call if_changed_dep,bindgen_helper)
261
268
0 commit comments