xref: /linux/rust/Makefile (revision 8373147ce4961665c5700016b1c76299e962d077)
1# SPDX-License-Identifier: GPL-2.0
2
3# Where to place rustdoc generated documentation
4rustdoc_output := $(objtree)/Documentation/output/rust/rustdoc
5
6obj-$(CONFIG_RUST) += core.o compiler_builtins.o
7always-$(CONFIG_RUST) += exports_core_generated.h
8
9# Missing prototypes are expected in the helpers since these are exported
10# for Rust only, thus there is no header nor prototypes.
11obj-$(CONFIG_RUST) += helpers/helpers.o
12CFLAGS_REMOVE_helpers/helpers.o = -Wmissing-prototypes -Wmissing-declarations
13
14always-$(CONFIG_RUST) += libmacros.so
15no-clean-files += libmacros.so
16
17always-$(CONFIG_RUST) += bindings/bindings_generated.rs bindings/bindings_helpers_generated.rs
18obj-$(CONFIG_RUST) += alloc.o bindings.o kernel.o
19always-$(CONFIG_RUST) += exports_alloc_generated.h exports_helpers_generated.h \
20    exports_bindings_generated.h exports_kernel_generated.h
21
22always-$(CONFIG_RUST) += uapi/uapi_generated.rs
23obj-$(CONFIG_RUST) += uapi.o
24
25ifdef CONFIG_RUST_BUILD_ASSERT_ALLOW
26obj-$(CONFIG_RUST) += build_error.o
27else
28always-$(CONFIG_RUST) += build_error.o
29endif
30
31obj-$(CONFIG_RUST) += exports.o
32
33always-$(CONFIG_RUST_KERNEL_DOCTESTS) += doctests_kernel_generated.rs
34always-$(CONFIG_RUST_KERNEL_DOCTESTS) += doctests_kernel_generated_kunit.c
35
36obj-$(CONFIG_RUST_KERNEL_DOCTESTS) += doctests_kernel_generated.o
37obj-$(CONFIG_RUST_KERNEL_DOCTESTS) += doctests_kernel_generated_kunit.o
38
39# Avoids running `$(RUSTC)` for the sysroot when it may not be available.
40ifdef CONFIG_RUST
41
42# `$(rust_flags)` is passed in case the user added `--sysroot`.
43rustc_sysroot := $(shell MAKEFLAGS= $(RUSTC) $(rust_flags) --print sysroot)
44rustc_host_target := $(shell $(RUSTC) --version --verbose | grep -F 'host: ' | cut -d' ' -f2)
45RUST_LIB_SRC ?= $(rustc_sysroot)/lib/rustlib/src/rust/library
46
47ifneq ($(quiet),)
48rust_test_quiet=-q
49rustdoc_test_quiet=--test-args -q
50rustdoc_test_kernel_quiet=>/dev/null
51endif
52
53core-cfgs = \
54    --cfg no_fp_fmt_parse
55
56alloc-cfgs = \
57    --cfg no_global_oom_handling \
58    --cfg no_rc \
59    --cfg no_sync
60
61quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $<
62      cmd_rustdoc = \
63	OBJTREE=$(abspath $(objtree)) \
64	$(RUSTDOC) $(filter-out $(skip_flags),$(if $(rustdoc_host),$(rust_common_flags),$(rust_flags))) \
65		$(rustc_target_flags) -L$(objtree)/$(obj) \
66		-Zunstable-options --generate-link-to-definition \
67		--output $(rustdoc_output) \
68		--crate-name $(subst rustdoc-,,$@) \
69		$(if $(rustdoc_host),,--sysroot=/dev/null) \
70		@$(objtree)/include/generated/rustc_cfg $<
71
72# The `html_logo_url` and `html_favicon_url` forms of the `doc` attribute
73# can be used to specify a custom logo. However:
74#   - The given value is used as-is, thus it cannot be relative or a local file
75#     (unlike the non-custom case) since the generated docs have subfolders.
76#   - It requires adding it to every crate.
77#   - It requires changing `core` which comes from the sysroot.
78#
79# Using `-Zcrate-attr` would solve the last two points, but not the first.
80# The https://github.com/rust-lang/rfcs/pull/3226 RFC suggests two new
81# command-like flags to solve the issue. Meanwhile, we use the non-custom case
82# and then retouch the generated files.
83rustdoc: rustdoc-core rustdoc-macros rustdoc-compiler_builtins \
84    rustdoc-alloc rustdoc-kernel
85	$(Q)cp $(srctree)/Documentation/images/logo.svg $(rustdoc_output)/static.files/
86	$(Q)cp $(srctree)/Documentation/images/COPYING-logo $(rustdoc_output)/static.files/
87	$(Q)find $(rustdoc_output) -name '*.html' -type f -print0 | xargs -0 sed -Ei \
88		-e 's:rust-logo-[0-9a-f]+\.svg:logo.svg:g' \
89		-e 's:favicon-[0-9a-f]+\.svg:logo.svg:g' \
90		-e 's:<link rel="alternate icon" type="image/png" href="[/.]+/static\.files/favicon-(16x16|32x32)-[0-9a-f]+\.png">::g' \
91		-e 's:<a href="srctree/([^"]+)">:<a href="$(realpath $(srctree))/\1">:g'
92	$(Q)for f in $(rustdoc_output)/static.files/rustdoc-*.css; do \
93		echo ".logo-container > img { object-fit: contain; }" >> $$f; done
94
95rustdoc-macros: private rustdoc_host = yes
96rustdoc-macros: private rustc_target_flags = --crate-type proc-macro \
97    --extern proc_macro
98rustdoc-macros: $(src)/macros/lib.rs FORCE
99	+$(call if_changed,rustdoc)
100
101# Starting with Rust 1.82.0, skipping `-Wrustdoc::unescaped_backticks` should
102# not be needed -- see https://github.com/rust-lang/rust/pull/128307.
103rustdoc-core: private skip_flags = -Wrustdoc::unescaped_backticks
104rustdoc-core: private rustc_target_flags = $(core-cfgs)
105rustdoc-core: $(RUST_LIB_SRC)/core/src/lib.rs FORCE
106	+$(call if_changed,rustdoc)
107
108rustdoc-compiler_builtins: $(src)/compiler_builtins.rs rustdoc-core FORCE
109	+$(call if_changed,rustdoc)
110
111# We need to allow `rustdoc::broken_intra_doc_links` because some
112# `no_global_oom_handling` functions refer to non-`no_global_oom_handling`
113# functions. Ideally `rustdoc` would have a way to distinguish broken links
114# due to things that are "configured out" vs. entirely non-existing ones.
115rustdoc-alloc: private rustc_target_flags = $(alloc-cfgs) \
116    -Arustdoc::broken_intra_doc_links
117rustdoc-alloc: $(RUST_LIB_SRC)/alloc/src/lib.rs rustdoc-core rustdoc-compiler_builtins FORCE
118	+$(call if_changed,rustdoc)
119
120rustdoc-kernel: private rustc_target_flags = --extern alloc \
121    --extern build_error --extern macros=$(objtree)/$(obj)/libmacros.so \
122    --extern bindings --extern uapi
123rustdoc-kernel: $(src)/kernel/lib.rs rustdoc-core rustdoc-macros \
124    rustdoc-compiler_builtins rustdoc-alloc $(obj)/libmacros.so \
125    $(obj)/bindings.o FORCE
126	+$(call if_changed,rustdoc)
127
128quiet_cmd_rustc_test_library = RUSTC TL $<
129      cmd_rustc_test_library = \
130	OBJTREE=$(abspath $(objtree)) \
131	$(RUSTC) $(rust_common_flags) \
132		@$(objtree)/include/generated/rustc_cfg $(rustc_target_flags) \
133		--crate-type $(if $(rustc_test_library_proc),proc-macro,rlib) \
134		--out-dir $(objtree)/$(obj)/test --cfg testlib \
135		-L$(objtree)/$(obj)/test \
136		--crate-name $(subst rusttest-,,$(subst rusttestlib-,,$@)) $<
137
138rusttestlib-build_error: $(src)/build_error.rs FORCE
139	+$(call if_changed,rustc_test_library)
140
141rusttestlib-macros: private rustc_target_flags = --extern proc_macro
142rusttestlib-macros: private rustc_test_library_proc = yes
143rusttestlib-macros: $(src)/macros/lib.rs FORCE
144	+$(call if_changed,rustc_test_library)
145
146rusttestlib-bindings: $(src)/bindings/lib.rs FORCE
147	+$(call if_changed,rustc_test_library)
148
149rusttestlib-uapi: $(src)/uapi/lib.rs FORCE
150	+$(call if_changed,rustc_test_library)
151
152quiet_cmd_rustdoc_test = RUSTDOC T $<
153      cmd_rustdoc_test = \
154	OBJTREE=$(abspath $(objtree)) \
155	$(RUSTDOC) --test $(rust_common_flags) \
156		@$(objtree)/include/generated/rustc_cfg \
157		$(rustc_target_flags) $(rustdoc_test_target_flags) \
158		$(rustdoc_test_quiet) \
159		-L$(objtree)/$(obj)/test --output $(rustdoc_output) \
160		--crate-name $(subst rusttest-,,$@) $<
161
162quiet_cmd_rustdoc_test_kernel = RUSTDOC TK $<
163      cmd_rustdoc_test_kernel = \
164	rm -rf $(objtree)/$(obj)/test/doctests/kernel; \
165	mkdir -p $(objtree)/$(obj)/test/doctests/kernel; \
166	OBJTREE=$(abspath $(objtree)) \
167	$(RUSTDOC) --test $(rust_flags) \
168		-L$(objtree)/$(obj) --extern alloc --extern kernel \
169		--extern build_error --extern macros \
170		--extern bindings --extern uapi \
171		--no-run --crate-name kernel -Zunstable-options \
172		--sysroot=/dev/null \
173		--test-builder $(objtree)/scripts/rustdoc_test_builder \
174		$< $(rustdoc_test_kernel_quiet); \
175	$(objtree)/scripts/rustdoc_test_gen
176
177%/doctests_kernel_generated.rs %/doctests_kernel_generated_kunit.c: \
178    $(src)/kernel/lib.rs $(obj)/kernel.o \
179    $(objtree)/scripts/rustdoc_test_builder \
180    $(objtree)/scripts/rustdoc_test_gen FORCE
181	+$(call if_changed,rustdoc_test_kernel)
182
183# We cannot use `-Zpanic-abort-tests` because some tests are dynamic,
184# so for the moment we skip `-Cpanic=abort`.
185quiet_cmd_rustc_test = RUSTC T  $<
186      cmd_rustc_test = \
187	OBJTREE=$(abspath $(objtree)) \
188	$(RUSTC) --test $(rust_common_flags) \
189		@$(objtree)/include/generated/rustc_cfg \
190		$(rustc_target_flags) --out-dir $(objtree)/$(obj)/test \
191		-L$(objtree)/$(obj)/test \
192		--crate-name $(subst rusttest-,,$@) $<; \
193	$(objtree)/$(obj)/test/$(subst rusttest-,,$@) $(rust_test_quiet) \
194		$(rustc_test_run_flags)
195
196rusttest: rusttest-macros rusttest-kernel
197
198rusttest-macros: private rustc_target_flags = --extern proc_macro
199rusttest-macros: private rustdoc_test_target_flags = --crate-type proc-macro
200rusttest-macros: $(src)/macros/lib.rs FORCE
201	+$(call if_changed,rustc_test)
202	+$(call if_changed,rustdoc_test)
203
204rusttest-kernel: private rustc_target_flags = --extern alloc \
205    --extern build_error --extern macros --extern bindings --extern uapi
206rusttest-kernel: $(src)/kernel/lib.rs \
207    rusttestlib-build_error rusttestlib-macros rusttestlib-bindings \
208    rusttestlib-uapi FORCE
209	+$(call if_changed,rustc_test)
210	+$(call if_changed,rustc_test_library)
211
212ifdef CONFIG_CC_IS_CLANG
213bindgen_c_flags = $(c_flags)
214else
215# bindgen relies on libclang to parse C. Ideally, bindgen would support a GCC
216# plugin backend and/or the Clang driver would be perfectly compatible with GCC.
217#
218# For the moment, here we are tweaking the flags on the fly. This is a hack,
219# and some kernel configurations may not work (e.g. `GCC_PLUGIN_RANDSTRUCT`
220# if we end up using one of those structs).
221bindgen_skip_c_flags := -mno-fp-ret-in-387 -mpreferred-stack-boundary=% \
222	-mskip-rax-setup -mgeneral-regs-only -msign-return-address=% \
223	-mindirect-branch=thunk-extern -mindirect-branch-register \
224	-mfunction-return=thunk-extern -mrecord-mcount -mabi=lp64 \
225	-mindirect-branch-cs-prefix -mstack-protector-guard% -mtraceback=no \
226	-mno-pointers-to-nested-functions -mno-string \
227	-mno-strict-align -mstrict-align \
228	-fconserve-stack -falign-jumps=% -falign-loops=% \
229	-femit-struct-debug-baseonly -fno-ipa-cp-clone -fno-ipa-sra \
230	-fno-partial-inlining -fplugin-arg-arm_ssp_per_task_plugin-% \
231	-fno-reorder-blocks -fno-allow-store-data-races -fasan-shadow-offset=% \
232	-fzero-call-used-regs=% -fno-stack-clash-protection \
233	-fno-inline-functions-called-once -fsanitize=bounds-strict \
234	-fstrict-flex-arrays=% -fmin-function-alignment=% \
235	--param=% --param asan-%
236
237# Derived from `scripts/Makefile.clang`.
238BINDGEN_TARGET_x86	:= x86_64-linux-gnu
239BINDGEN_TARGET_arm64	:= aarch64-linux-gnu
240BINDGEN_TARGET		:= $(BINDGEN_TARGET_$(SRCARCH))
241
242# All warnings are inhibited since GCC builds are very experimental,
243# many GCC warnings are not supported by Clang, they may only appear in
244# some configurations, with new GCC versions, etc.
245bindgen_extra_c_flags = -w --target=$(BINDGEN_TARGET)
246
247# Auto variable zero-initialization requires an additional special option with
248# clang that is going to be removed sometime in the future (likely in
249# clang-18), so make sure to pass this option only if clang supports it
250# (libclang major version < 16).
251#
252# https://github.com/llvm/llvm-project/issues/44842
253# https://github.com/llvm/llvm-project/blob/llvmorg-16.0.0-rc2/clang/docs/ReleaseNotes.rst#deprecated-compiler-flags
254ifdef CONFIG_INIT_STACK_ALL_ZERO
255libclang_maj_ver=$(shell $(BINDGEN) $(srctree)/scripts/rust_is_available_bindgen_libclang.h 2>&1 | sed -ne 's/.*clang version \([0-9]*\).*/\1/p')
256ifeq ($(shell expr $(libclang_maj_ver) \< 16), 1)
257bindgen_extra_c_flags += -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
258endif
259endif
260
261bindgen_c_flags = $(filter-out $(bindgen_skip_c_flags), $(c_flags)) \
262	$(bindgen_extra_c_flags)
263endif
264
265ifdef CONFIG_LTO
266bindgen_c_flags_lto = $(filter-out $(CC_FLAGS_LTO), $(bindgen_c_flags))
267else
268bindgen_c_flags_lto = $(bindgen_c_flags)
269endif
270
271bindgen_c_flags_final = $(bindgen_c_flags_lto) -D__BINDGEN__
272
273quiet_cmd_bindgen = BINDGEN $@
274      cmd_bindgen = \
275	$(BINDGEN) $< $(bindgen_target_flags) \
276		--use-core --with-derive-default --ctypes-prefix core::ffi --no-layout-tests \
277		--no-debug '.*' --enable-function-attribute-detection \
278		-o $@ -- $(bindgen_c_flags_final) -DMODULE \
279		$(bindgen_target_cflags) $(bindgen_target_extra)
280
281$(obj)/bindings/bindings_generated.rs: private bindgen_target_flags = \
282    $(shell grep -Ev '^#|^$$' $(src)/bindgen_parameters)
283$(obj)/bindings/bindings_generated.rs: private bindgen_target_extra = ; \
284    sed -Ei 's/pub const RUST_CONST_HELPER_([a-zA-Z0-9_]*)/pub const \1/g' $@
285$(obj)/bindings/bindings_generated.rs: $(src)/bindings/bindings_helper.h \
286    $(src)/bindgen_parameters FORCE
287	$(call if_changed_dep,bindgen)
288
289$(obj)/uapi/uapi_generated.rs: private bindgen_target_flags = \
290    $(shell grep -Ev '^#|^$$' $(src)/bindgen_parameters)
291$(obj)/uapi/uapi_generated.rs: $(src)/uapi/uapi_helper.h \
292    $(src)/bindgen_parameters FORCE
293	$(call if_changed_dep,bindgen)
294
295# See `CFLAGS_REMOVE_helpers.o` above. In addition, Clang on C does not warn
296# with `-Wmissing-declarations` (unlike GCC), so it is not strictly needed here
297# given it is `libclang`; but for consistency, future Clang changes and/or
298# a potential future GCC backend for `bindgen`, we disable it too.
299$(obj)/bindings/bindings_helpers_generated.rs: private bindgen_target_flags = \
300    --blocklist-type '.*' --allowlist-var '' \
301    --allowlist-function 'rust_helper_.*'
302$(obj)/bindings/bindings_helpers_generated.rs: private bindgen_target_cflags = \
303    -I$(objtree)/$(obj) -Wno-missing-prototypes -Wno-missing-declarations
304$(obj)/bindings/bindings_helpers_generated.rs: private bindgen_target_extra = ; \
305    sed -Ei 's/pub fn rust_helper_([a-zA-Z0-9_]*)/#[link_name="rust_helper_\1"]\n    pub fn \1/g' $@
306$(obj)/bindings/bindings_helpers_generated.rs: $(src)/helpers/helpers.c FORCE
307	$(call if_changed_dep,bindgen)
308
309quiet_cmd_exports = EXPORTS $@
310      cmd_exports = \
311	$(NM) -p --defined-only $< \
312		| awk '$$2~/(T|R|D|B)/ && $$3!~/__cfi/ {printf "EXPORT_SYMBOL_RUST_GPL(%s);\n",$$3}' > $@
313
314$(obj)/exports_core_generated.h: $(obj)/core.o FORCE
315	$(call if_changed,exports)
316
317$(obj)/exports_alloc_generated.h: $(obj)/alloc.o FORCE
318	$(call if_changed,exports)
319
320# Even though Rust kernel modules should never use the bindings directly,
321# symbols from the `bindings` crate and the C helpers need to be exported
322# because Rust generics and inlined functions may not get their code generated
323# in the crate where they are defined. Other helpers, called from non-inline
324# functions, may not be exported, in principle. However, in general, the Rust
325# compiler does not guarantee codegen will be performed for a non-inline
326# function either. Therefore, we export all symbols from helpers and bindings.
327# In the future, this may be revisited to reduce the number of exports after
328# the compiler is informed about the places codegen is required.
329$(obj)/exports_helpers_generated.h: $(obj)/helpers/helpers.o FORCE
330	$(call if_changed,exports)
331
332$(obj)/exports_bindings_generated.h: $(obj)/bindings.o FORCE
333	$(call if_changed,exports)
334
335$(obj)/exports_kernel_generated.h: $(obj)/kernel.o FORCE
336	$(call if_changed,exports)
337
338quiet_cmd_rustc_procmacro = $(RUSTC_OR_CLIPPY_QUIET) P $@
339      cmd_rustc_procmacro = \
340	$(RUSTC_OR_CLIPPY) $(rust_common_flags) \
341		-Clinker-flavor=gcc -Clinker=$(HOSTCC) \
342		-Clink-args='$(call escsq,$(KBUILD_HOSTLDFLAGS))' \
343		--emit=dep-info=$(depfile) --emit=link=$@ --extern proc_macro \
344		--crate-type proc-macro \
345		--crate-name $(patsubst lib%.so,%,$(notdir $@)) $<
346
347# Procedural macros can only be used with the `rustc` that compiled it.
348$(obj)/libmacros.so: $(src)/macros/lib.rs FORCE
349	+$(call if_changed_dep,rustc_procmacro)
350
351quiet_cmd_rustc_library = $(if $(skip_clippy),RUSTC,$(RUSTC_OR_CLIPPY_QUIET)) L $@
352      cmd_rustc_library = \
353	OBJTREE=$(abspath $(objtree)) \
354	$(if $(skip_clippy),$(RUSTC),$(RUSTC_OR_CLIPPY)) \
355		$(filter-out $(skip_flags),$(rust_flags) $(rustc_target_flags)) \
356		--emit=dep-info=$(depfile) --emit=obj=$@ \
357		--emit=metadata=$(dir $@)$(patsubst %.o,lib%.rmeta,$(notdir $@)) \
358		--crate-type rlib -L$(objtree)/$(obj) \
359		--crate-name $(patsubst %.o,%,$(notdir $@)) $< \
360		--sysroot=/dev/null \
361	$(if $(rustc_objcopy),;$(OBJCOPY) $(rustc_objcopy) $@) \
362	$(cmd_objtool)
363
364rust-analyzer:
365	$(Q)$(srctree)/scripts/generate_rust_analyzer.py \
366		--cfgs='core=$(core-cfgs)' --cfgs='alloc=$(alloc-cfgs)' \
367		$(realpath $(srctree)) $(realpath $(objtree)) \
368		$(rustc_sysroot) $(RUST_LIB_SRC) $(KBUILD_EXTMOD) > \
369		$(if $(KBUILD_EXTMOD),$(extmod_prefix),$(objtree))/rust-project.json
370
371redirect-intrinsics = \
372	__addsf3 __eqsf2 __extendsfdf2 __gesf2 __lesf2 __ltsf2 __mulsf3 __nesf2 __truncdfsf2 __unordsf2 \
373	__adddf3 __eqdf2 __ledf2 __ltdf2 __muldf3 __unorddf2 \
374	__muloti4 __multi3 \
375	__udivmodti4 __udivti3 __umodti3
376
377ifneq ($(or $(CONFIG_ARM64),$(and $(CONFIG_RISCV),$(CONFIG_64BIT))),)
378	# These intrinsics are defined for ARM64 and RISCV64
379	redirect-intrinsics += \
380		__ashrti3 \
381		__ashlti3 __lshrti3
382endif
383
384define rule_rustc_library
385	$(call cmd_and_fixdep,rustc_library)
386	$(call cmd,gen_objtooldep)
387endef
388
389$(obj)/core.o: private skip_clippy = 1
390$(obj)/core.o: private skip_flags = -Wunreachable_pub
391$(obj)/core.o: private rustc_objcopy = $(foreach sym,$(redirect-intrinsics),--redefine-sym $(sym)=__rust$(sym))
392$(obj)/core.o: private rustc_target_flags = $(core-cfgs)
393$(obj)/core.o: $(RUST_LIB_SRC)/core/src/lib.rs \
394    $(wildcard $(objtree)/include/config/RUSTC_VERSION_TEXT) FORCE
395	+$(call if_changed_rule,rustc_library)
396ifneq ($(or $(CONFIG_X86_64),$(CONFIG_X86_32)),)
397$(obj)/core.o: scripts/target.json
398endif
399
400$(obj)/compiler_builtins.o: private rustc_objcopy = -w -W '__*'
401$(obj)/compiler_builtins.o: $(src)/compiler_builtins.rs $(obj)/core.o FORCE
402	+$(call if_changed_rule,rustc_library)
403
404$(obj)/alloc.o: private skip_clippy = 1
405$(obj)/alloc.o: private skip_flags = -Wunreachable_pub
406$(obj)/alloc.o: private rustc_target_flags = $(alloc-cfgs)
407$(obj)/alloc.o: $(RUST_LIB_SRC)/alloc/src/lib.rs $(obj)/compiler_builtins.o FORCE
408	+$(call if_changed_rule,rustc_library)
409
410$(obj)/build_error.o: $(src)/build_error.rs $(obj)/compiler_builtins.o FORCE
411	+$(call if_changed_rule,rustc_library)
412
413$(obj)/bindings.o: $(src)/bindings/lib.rs \
414    $(obj)/compiler_builtins.o \
415    $(obj)/bindings/bindings_generated.rs \
416    $(obj)/bindings/bindings_helpers_generated.rs FORCE
417	+$(call if_changed_rule,rustc_library)
418
419$(obj)/uapi.o: $(src)/uapi/lib.rs \
420    $(obj)/compiler_builtins.o \
421    $(obj)/uapi/uapi_generated.rs FORCE
422	+$(call if_changed_rule,rustc_library)
423
424$(obj)/kernel.o: private rustc_target_flags = --extern alloc \
425    --extern build_error --extern macros --extern bindings --extern uapi
426$(obj)/kernel.o: $(src)/kernel/lib.rs $(obj)/alloc.o $(obj)/build_error.o \
427    $(obj)/libmacros.so $(obj)/bindings.o $(obj)/uapi.o FORCE
428	+$(call if_changed_rule,rustc_library)
429
430endif # CONFIG_RUST
431