@@ -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 \
@@ -105,20 +100,11 @@ rustdoc-core: $(RUST_LIB_SRC)/core/src/lib.rs FORCE
105
100
rustdoc-compiler_builtins : $(src ) /compiler_builtins.rs rustdoc-core FORCE
106
101
+$(call if_changed,rustdoc)
107
102
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 = \
118
104
--extern build_error --extern macros=$(objtree)/$(obj)/libmacros.so \
119
105
--extern bindings --extern uapi
120
106
rustdoc-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 \
122
108
$(obj)/bindings.o FORCE
123
109
+$(call if_changed,rustdoc)
124
110
@@ -162,7 +148,7 @@ quiet_cmd_rustdoc_test_kernel = RUSTDOC TK $<
162
148
mkdir -p $(objtree ) /$(obj ) /test/doctests/kernel; \
163
149
OBJTREE=$(abspath $(objtree ) ) \
164
150
$(RUSTDOC ) --test $(rust_flags ) \
165
- -L$(objtree ) /$(obj ) --extern alloc --extern kernel \
151
+ -L$(objtree ) /$(obj ) --extern kernel \
166
152
--extern build_error --extern macros \
167
153
--extern bindings --extern uapi \
168
154
--no-run --crate-name kernel -Zunstable-options \
@@ -198,7 +184,7 @@ rusttest-macros: $(src)/macros/lib.rs FORCE
198
184
+$(call if_changed,rustc_test)
199
185
+$(call if_changed,rustdoc_test)
200
186
201
- rusttest-kernel : private rustc_target_flags = --extern alloc \
187
+ rusttest-kernel : private rustc_target_flags = \
202
188
--extern build_error --extern macros --extern bindings --extern uapi
203
189
rusttest-kernel : $(src ) /kernel/lib.rs \
204
190
rusttestlib-build_error rusttestlib-macros rusttestlib-bindings \
@@ -311,9 +297,6 @@ quiet_cmd_exports = EXPORTS $@
311
297
$(obj ) /exports_core_generated.h : $(obj ) /core.o FORCE
312
298
$(call if_changed,exports)
313
299
314
- $(obj ) /exports_alloc_generated.h : $(obj ) /alloc.o FORCE
315
- $(call if_changed,exports)
316
-
317
300
# Even though Rust kernel modules should never use the bindings directly,
318
301
# symbols from the `bindings` crate and the C helpers need to be exported
319
302
# 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
360
343
361
344
rust-analyzer :
362
345
$(Q )$(srctree ) /scripts/generate_rust_analyzer.py \
363
- --cfgs=' core=$(core-cfgs)' --cfgs= ' alloc=$(alloc-cfgs) ' \
346
+ --cfgs=' core=$(core-cfgs)' \
364
347
$(realpath $(srctree ) ) $(realpath $(objtree ) ) \
365
348
$(rustc_sysroot ) $(RUST_LIB_SRC ) $(KBUILD_EXTMOD ) > \
366
349
$(if $(KBUILD_EXTMOD ) ,$(extmod_prefix ) ,$(objtree ) ) /rust-project.json
@@ -398,12 +381,6 @@ $(obj)/compiler_builtins.o: private rustc_objcopy = -w -W '__*'
398
381
$(obj ) /compiler_builtins.o : $(src ) /compiler_builtins.rs $(obj ) /core.o FORCE
399
382
+$(call if_changed_rule,rustc_library)
400
383
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
-
407
384
$(obj ) /build_error.o : $(src ) /build_error.rs $(obj ) /compiler_builtins.o FORCE
408
385
+$(call if_changed_rule,rustc_library)
409
386
@@ -418,9 +395,9 @@ $(obj)/uapi.o: $(src)/uapi/lib.rs \
418
395
$(obj)/uapi/uapi_generated.rs FORCE
419
396
+$(call if_changed_rule,rustc_library)
420
397
421
- $(obj ) /kernel.o : private rustc_target_flags = --extern alloc \
398
+ $(obj ) /kernel.o : private rustc_target_flags = \
422
399
--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 \
424
401
$(obj)/libmacros.so $(obj)/bindings.o $(obj)/uapi.o FORCE
425
402
+$(call if_changed_rule,rustc_library)
426
403
0 commit comments