@@ -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 \
@@ -105,20 +100,11 @@ rustdoc-core: $(RUST_LIB_SRC)/core/src/lib.rs FORCE
105100rustdoc-compiler_builtins : $(src ) /compiler_builtins.rs rustdoc-core FORCE
106101 +$(call if_changed,rustdoc)
107102
108- # We need to allow `rustdoc::broken_intra_doc_links` because some
109- # `no_global_oom_handling` functions refer to non-`no_global_oom_handling`
110- # functions. Ideally `rustdoc` would have a way to distinguish broken links
111- # due to things that are "configured out" vs. entirely non-existing ones.
112- rustdoc-alloc : private rustc_target_flags = $(alloc-cfgs ) \
113- -Arustdoc ::broken_intra_doc_links
114- rustdoc-alloc : $(RUST_LIB_SRC ) /alloc/src/lib.rs rustdoc-core rustdoc-compiler_builtins FORCE
115- +$(call if_changed,rustdoc)
116-
117- rustdoc-kernel : private rustc_target_flags = --extern alloc \
103+ rustdoc-kernel : private rustc_target_flags = \
118104 --extern build_error --extern macros=$(objtree)/$(obj)/libmacros.so \
119105 --extern bindings --extern uapi
120106rustdoc-kernel : $(src ) /kernel/lib.rs rustdoc-core rustdoc-macros \
121- rustdoc-compiler_builtins rustdoc-alloc $(obj)/libmacros.so \
107+ rustdoc-compiler_builtins $(obj)/libmacros.so \
122108 $(obj)/bindings.o FORCE
123109 +$(call if_changed,rustdoc)
124110
@@ -162,7 +148,7 @@ quiet_cmd_rustdoc_test_kernel = RUSTDOC TK $<
162148 mkdir -p $(objtree ) /$(obj ) /test/doctests/kernel; \
163149 OBJTREE=$(abspath $(objtree ) ) \
164150 $(RUSTDOC ) --test $(rust_flags ) \
165- -L$(objtree ) /$(obj ) --extern alloc --extern kernel \
151+ -L$(objtree ) /$(obj ) --extern kernel \
166152 --extern build_error --extern macros \
167153 --extern bindings --extern uapi \
168154 --no-run --crate-name kernel -Zunstable-options \
@@ -198,7 +184,7 @@ rusttest-macros: $(src)/macros/lib.rs FORCE
198184 +$(call if_changed,rustc_test)
199185 +$(call if_changed,rustdoc_test)
200186
201- rusttest-kernel : private rustc_target_flags = --extern alloc \
187+ rusttest-kernel : private rustc_target_flags = \
202188 --extern build_error --extern macros --extern bindings --extern uapi
203189rusttest-kernel : $(src ) /kernel/lib.rs \
204190 rusttestlib-build_error rusttestlib-macros rusttestlib-bindings \
@@ -311,9 +297,6 @@ quiet_cmd_exports = EXPORTS $@
311297$(obj ) /exports_core_generated.h : $(obj ) /core.o FORCE
312298 $(call if_changed,exports)
313299
314- $(obj ) /exports_alloc_generated.h : $(obj ) /alloc.o FORCE
315- $(call if_changed,exports)
316-
317300# Even though Rust kernel modules should never use the bindings directly,
318301# symbols from the `bindings` crate and the C helpers need to be exported
319302# because Rust generics and inlined functions may not get their code generated
@@ -360,7 +343,7 @@ quiet_cmd_rustc_library = $(if $(skip_clippy),RUSTC,$(RUSTC_OR_CLIPPY_QUIET)) L
360343
361344rust-analyzer :
362345 $(Q )$(srctree ) /scripts/generate_rust_analyzer.py \
363- --cfgs=' core=$(core-cfgs)' --cfgs= ' alloc=$(alloc-cfgs) ' \
346+ --cfgs=' core=$(core-cfgs)' \
364347 $(realpath $(srctree ) ) $(realpath $(objtree ) ) \
365348 $(rustc_sysroot ) $(RUST_LIB_SRC ) $(KBUILD_EXTMOD ) > \
366349 $(if $(KBUILD_EXTMOD ) ,$(extmod_prefix ) ,$(objtree ) ) /rust-project.json
@@ -398,12 +381,6 @@ $(obj)/compiler_builtins.o: private rustc_objcopy = -w -W '__*'
398381$(obj ) /compiler_builtins.o : $(src ) /compiler_builtins.rs $(obj ) /core.o FORCE
399382 +$(call if_changed_rule,rustc_library)
400383
401- $(obj ) /alloc.o : private skip_clippy = 1
402- $(obj ) /alloc.o : private skip_flags = -Wunreachable_pub
403- $(obj ) /alloc.o : private rustc_target_flags = $(alloc-cfgs )
404- $(obj ) /alloc.o : $(RUST_LIB_SRC ) /alloc/src/lib.rs $(obj ) /compiler_builtins.o FORCE
405- +$(call if_changed_rule,rustc_library)
406-
407384$(obj ) /build_error.o : $(src ) /build_error.rs $(obj ) /compiler_builtins.o FORCE
408385 +$(call if_changed_rule,rustc_library)
409386
@@ -418,9 +395,9 @@ $(obj)/uapi.o: $(src)/uapi/lib.rs \
418395 $(obj)/uapi/uapi_generated.rs FORCE
419396 +$(call if_changed_rule,rustc_library)
420397
421- $(obj ) /kernel.o : private rustc_target_flags = --extern alloc \
398+ $(obj ) /kernel.o : private rustc_target_flags = \
422399 --extern build_error --extern macros --extern bindings --extern uapi
423- $(obj ) /kernel.o : $(src ) /kernel/lib.rs $(obj ) /alloc.o $( obj ) / build_error.o \
400+ $(obj ) /kernel.o : $(src ) /kernel/lib.rs $(obj ) /build_error.o \
424401 $(obj)/libmacros.so $(obj)/bindings.o $(obj)/uapi.o FORCE
425402 +$(call if_changed_rule,rustc_library)
426403
0 commit comments