@@ -84,18 +84,17 @@ bindgen_c_flags = $(filter-out $(bindgen_skip_c_flags), $(c_flags)) \
84
84
$(bindgen_extra_c_flags )
85
85
endif
86
86
87
- bindgen_opaque_types := xregs_state desc_struct arch_lbr_state local_apic
88
-
89
87
# To avoid several recompilations in PowerPC, which inserts `-D_TASK_CPU`
90
88
bindgen_c_flags_final = $(filter-out -D_TASK_CPU=% , $(bindgen_c_flags ) )
91
89
92
90
quiet_cmd_bindgen = BINDGEN $@
93
91
cmd_bindgen = \
94
- $(BINDGEN ) $< $(addprefix --opaque-type , $(bindgen_opaque_types ) ) \
92
+ $(BINDGEN ) $< $(shell grep -v '^\#\|^$$' $(srctree ) /rust/bindgen_parameters ) \
95
93
--use-core --with-derive-default --ctypes-prefix c_types \
96
94
--size_t-is-usize -o $@ -- $(bindgen_c_flags_final ) -DMODULE
97
95
98
- $(objtree ) /rust/bindings_generated.rs : $(srctree ) /rust/kernel/bindings_helper.h FORCE
96
+ $(objtree ) /rust/bindings_generated.rs : $(srctree ) /rust/kernel/bindings_helper.h \
97
+ $(srctree ) /rust/bindgen_parameters FORCE
99
98
$(call if_changed_dep,bindgen)
100
99
101
100
quiet_cmd_exports = EXPORTS $@
@@ -126,7 +125,11 @@ quiet_cmd_rustc_procmacro = $(RUSTC_OR_CLIPPY_QUIET) P $@
126
125
mv $(objtree ) /rust/$(patsubst lib% .so,% ,$(notdir $@ ) ) .d $(depfile ) ; \
127
126
sed -i '/^\# /d' $(depfile)
128
127
129
- $(objtree ) /rust/libmodule.so : $(srctree ) /rust/module.rs FORCE
128
+ # Procedural macros can only be used with the `rustc` that compiled it.
129
+ # Therefore, to get `libmodule.so` automatically recompiled when the compiler
130
+ # version changes, we add `core.o` as a dependency (even if it is not needed).
131
+ $(objtree ) /rust/libmodule.so : $(srctree ) /rust/module.rs \
132
+ $(objtree ) /rust/core.o FORCE
130
133
$(call if_changed_dep,rustc_procmacro)
131
134
132
135
quiet_cmd_rustc_library = $(if $(skip_clippy ) ,RUSTC,$(RUSTC_OR_CLIPPY_QUIET ) ) L $@
0 commit comments