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