@@ -15,8 +15,8 @@ always-$(CONFIG_RUST) += libmacros.so
1515no-clean-files += libmacros.so
1616
1717always-$(CONFIG_RUST) += bindings/bindings_generated.rs bindings/bindings_helpers_generated.rs
18- obj-$(CONFIG_RUST) += alloc.o bindings.o kernel.o
19- always-$(CONFIG_RUST) += exports_alloc_generated.h exports_helpers_generated.h \
18+ obj-$(CONFIG_RUST) += bindings.o kernel.o
19+ always-$(CONFIG_RUST) += exports_helpers_generated.h \
2020 exports_bindings_generated.h exports_kernel_generated.h
2121
2222always-$(CONFIG_RUST) += uapi/uapi_generated.rs
5353core-cfgs = \
5454 --cfg no_fp_fmt_parse
5555
56- alloc-cfgs = \
57- --cfg no_global_oom_handling \
58- --cfg no_rc \
59- --cfg no_sync
60-
6156quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host ) ,H, ) $<
6257 cmd_rustdoc = \
6358 OBJTREE=$(abspath $(objtree ) ) \
@@ -81,7 +76,7 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $<
8176# command-like flags to solve the issue. Meanwhile, we use the non-custom case
8277# and then retouch the generated files.
8378rustdoc : rustdoc-core rustdoc-macros rustdoc-compiler_builtins \
84- rustdoc-alloc rustdoc- kernel
79+ rustdoc-kernel
8580 $(Q)cp $(srctree)/Documentation/images/logo.svg $(rustdoc_output)/static.files/
8681 $(Q)cp $(srctree)/Documentation/images/COPYING-logo $(rustdoc_output)/static.files/
8782 $(Q)find $(rustdoc_output) -name '*.html' -type f -print0 | xargs -0 sed -Ei \
@@ -108,20 +103,11 @@ rustdoc-core: $(RUST_LIB_SRC)/core/src/lib.rs FORCE
108103rustdoc-compiler_builtins : $(src ) /compiler_builtins.rs rustdoc-core FORCE
109104 +$(call if_changed,rustdoc)
110105
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.
115- rustdoc-alloc : private rustc_target_flags = $(alloc-cfgs ) \
116- -Arustdoc ::broken_intra_doc_links
117- rustdoc-alloc : $(RUST_LIB_SRC ) /alloc/src/lib.rs rustdoc-core rustdoc-compiler_builtins FORCE
118- +$(call if_changed,rustdoc)
119-
120- rustdoc-kernel : private rustc_target_flags = --extern alloc \
106+ rustdoc-kernel : private rustc_target_flags = \
121107 --extern build_error --extern macros=$(objtree)/$(obj)/libmacros.so \
122108 --extern bindings --extern uapi
123109rustdoc-kernel : $(src ) /kernel/lib.rs rustdoc-core rustdoc-macros \
124- rustdoc-compiler_builtins rustdoc-alloc $(obj)/libmacros.so \
110+ rustdoc-compiler_builtins $(obj)/libmacros.so \
125111 $(obj)/bindings.o FORCE
126112 +$(call if_changed,rustdoc)
127113
@@ -165,7 +151,7 @@ quiet_cmd_rustdoc_test_kernel = RUSTDOC TK $<
165151 mkdir -p $(objtree ) /$(obj ) /test/doctests/kernel; \
166152 OBJTREE=$(abspath $(objtree ) ) \
167153 $(RUSTDOC ) --test $(rust_flags ) \
168- -L$(objtree ) /$(obj ) --extern alloc --extern kernel \
154+ -L$(objtree ) /$(obj ) --extern kernel \
169155 --extern build_error --extern macros \
170156 --extern bindings --extern uapi \
171157 --no-run --crate-name kernel -Zunstable-options \
@@ -201,7 +187,7 @@ rusttest-macros: $(src)/macros/lib.rs FORCE
201187 +$(call if_changed,rustc_test)
202188 +$(call if_changed,rustdoc_test)
203189
204- rusttest-kernel : private rustc_target_flags = --extern alloc \
190+ rusttest-kernel : private rustc_target_flags = \
205191 --extern build_error --extern macros --extern bindings --extern uapi
206192rusttest-kernel : $(src ) /kernel/lib.rs \
207193 rusttestlib-build_error rusttestlib-macros rusttestlib-bindings \
@@ -314,9 +300,6 @@ quiet_cmd_exports = EXPORTS $@
314300$(obj ) /exports_core_generated.h : $(obj ) /core.o FORCE
315301 $(call if_changed,exports)
316302
317- $(obj ) /exports_alloc_generated.h : $(obj ) /alloc.o FORCE
318- $(call if_changed,exports)
319-
320303# Even though Rust kernel modules should never use the bindings directly,
321304# symbols from the `bindings` crate and the C helpers need to be exported
322305# because Rust generics and inlined functions may not get their code generated
@@ -363,7 +346,7 @@ quiet_cmd_rustc_library = $(if $(skip_clippy),RUSTC,$(RUSTC_OR_CLIPPY_QUIET)) L
363346
364347rust-analyzer :
365348 $(Q )$(srctree ) /scripts/generate_rust_analyzer.py \
366- --cfgs=' core=$(core-cfgs)' --cfgs= ' alloc=$(alloc-cfgs) ' \
349+ --cfgs=' core=$(core-cfgs)' \
367350 $(realpath $(srctree ) ) $(realpath $(objtree ) ) \
368351 $(rustc_sysroot ) $(RUST_LIB_SRC ) $(KBUILD_EXTMOD ) > \
369352 $(if $(KBUILD_EXTMOD ) ,$(extmod_prefix ) ,$(objtree ) ) /rust-project.json
@@ -401,12 +384,6 @@ $(obj)/compiler_builtins.o: private rustc_objcopy = -w -W '__*'
401384$(obj ) /compiler_builtins.o : $(src ) /compiler_builtins.rs $(obj ) /core.o FORCE
402385 +$(call if_changed_rule,rustc_library)
403386
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-
410387$(obj ) /build_error.o : $(src ) /build_error.rs $(obj ) /compiler_builtins.o FORCE
411388 +$(call if_changed_rule,rustc_library)
412389
@@ -421,9 +398,9 @@ $(obj)/uapi.o: $(src)/uapi/lib.rs \
421398 $(obj)/uapi/uapi_generated.rs FORCE
422399 +$(call if_changed_rule,rustc_library)
423400
424- $(obj ) /kernel.o : private rustc_target_flags = --extern alloc \
401+ $(obj ) /kernel.o : private rustc_target_flags = \
425402 --extern build_error --extern macros --extern bindings --extern uapi
426- $(obj ) /kernel.o : $(src ) /kernel/lib.rs $(obj ) /alloc.o $( obj ) / build_error.o \
403+ $(obj ) /kernel.o : $(src ) /kernel/lib.rs $(obj ) /build_error.o \
427404 $(obj)/libmacros.so $(obj)/bindings.o $(obj)/uapi.o FORCE
428405 +$(call if_changed_rule,rustc_library)
429406
0 commit comments