@@ -15,8 +15,8 @@ always-$(CONFIG_RUST) += libmacros.so
15
15
no-clean-files += libmacros.so
16
16
17
17
always-$(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 \
20
20
exports_bindings_generated.h exports_kernel_generated.h
21
21
22
22
always-$(CONFIG_RUST) += uapi/uapi_generated.rs
53
53
core-cfgs = \
54
54
--cfg no_fp_fmt_parse
55
55
56
- alloc-cfgs = \
57
- --cfg no_global_oom_handling \
58
- --cfg no_rc \
59
- --cfg no_sync
60
-
61
56
quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host ) ,H, ) $<
62
57
cmd_rustdoc = \
63
58
OBJTREE=$(abspath $(objtree ) ) \
@@ -81,7 +76,7 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $<
81
76
# command-like flags to solve the issue. Meanwhile, we use the non-custom case
82
77
# and then retouch the generated files.
83
78
rustdoc : rustdoc-core rustdoc-macros rustdoc-compiler_builtins \
84
- rustdoc-alloc rustdoc- kernel
79
+ rustdoc-kernel
85
80
$(Q)cp $(srctree)/Documentation/images/logo.svg $(rustdoc_output)/static.files/
86
81
$(Q)cp $(srctree)/Documentation/images/COPYING-logo $(rustdoc_output)/static.files/
87
82
$(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
108
103
rustdoc-compiler_builtins : $(src ) /compiler_builtins.rs rustdoc-core FORCE
109
104
+$(call if_changed,rustdoc)
110
105
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 = \
121
107
--extern build_error --extern macros=$(objtree)/$(obj)/libmacros.so \
122
108
--extern bindings --extern uapi
123
109
rustdoc-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 \
125
111
$(obj)/bindings.o FORCE
126
112
+$(call if_changed,rustdoc)
127
113
@@ -165,7 +151,7 @@ quiet_cmd_rustdoc_test_kernel = RUSTDOC TK $<
165
151
mkdir -p $(objtree ) /$(obj ) /test/doctests/kernel; \
166
152
OBJTREE=$(abspath $(objtree ) ) \
167
153
$(RUSTDOC ) --test $(rust_flags ) \
168
- -L$(objtree ) /$(obj ) --extern alloc --extern kernel \
154
+ -L$(objtree ) /$(obj ) --extern kernel \
169
155
--extern build_error --extern macros \
170
156
--extern bindings --extern uapi \
171
157
--no-run --crate-name kernel -Zunstable-options \
@@ -201,7 +187,7 @@ rusttest-macros: $(src)/macros/lib.rs FORCE
201
187
+$(call if_changed,rustc_test)
202
188
+$(call if_changed,rustdoc_test)
203
189
204
- rusttest-kernel : private rustc_target_flags = --extern alloc \
190
+ rusttest-kernel : private rustc_target_flags = \
205
191
--extern build_error --extern macros --extern bindings --extern uapi
206
192
rusttest-kernel : $(src ) /kernel/lib.rs \
207
193
rusttestlib-build_error rusttestlib-macros rusttestlib-bindings \
@@ -314,9 +300,6 @@ quiet_cmd_exports = EXPORTS $@
314
300
$(obj ) /exports_core_generated.h : $(obj ) /core.o FORCE
315
301
$(call if_changed,exports)
316
302
317
- $(obj ) /exports_alloc_generated.h : $(obj ) /alloc.o FORCE
318
- $(call if_changed,exports)
319
-
320
303
# Even though Rust kernel modules should never use the bindings directly,
321
304
# symbols from the `bindings` crate and the C helpers need to be exported
322
305
# 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
363
346
364
347
rust-analyzer :
365
348
$(Q )$(srctree ) /scripts/generate_rust_analyzer.py \
366
- --cfgs=' core=$(core-cfgs)' --cfgs= ' alloc=$(alloc-cfgs) ' \
349
+ --cfgs=' core=$(core-cfgs)' \
367
350
$(realpath $(srctree ) ) $(realpath $(objtree ) ) \
368
351
$(rustc_sysroot ) $(RUST_LIB_SRC ) $(KBUILD_EXTMOD ) > \
369
352
$(if $(KBUILD_EXTMOD ) ,$(extmod_prefix ) ,$(objtree ) ) /rust-project.json
@@ -401,12 +384,6 @@ $(obj)/compiler_builtins.o: private rustc_objcopy = -w -W '__*'
401
384
$(obj ) /compiler_builtins.o : $(src ) /compiler_builtins.rs $(obj ) /core.o FORCE
402
385
+$(call if_changed_rule,rustc_library)
403
386
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
-
410
387
$(obj ) /build_error.o : $(src ) /build_error.rs $(obj ) /compiler_builtins.o FORCE
411
388
+$(call if_changed_rule,rustc_library)
412
389
@@ -421,9 +398,9 @@ $(obj)/uapi.o: $(src)/uapi/lib.rs \
421
398
$(obj)/uapi/uapi_generated.rs FORCE
422
399
+$(call if_changed_rule,rustc_library)
423
400
424
- $(obj ) /kernel.o : private rustc_target_flags = --extern alloc \
401
+ $(obj ) /kernel.o : private rustc_target_flags = \
425
402
--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 \
427
404
$(obj)/libmacros.so $(obj)/bindings.o $(obj)/uapi.o FORCE
428
405
+$(call if_changed_rule,rustc_library)
429
406
0 commit comments