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