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