History

rust: Suppress searching builtin sysroot

By default, if Rust is passed `--target=foo` rather than a target.json file, it will infer a default sysroot if that component is installed. As the proposed aarch64 support [1] uses `aarch64-unknown-none` rather than a target.json file, this is needed [2] to prevent rustc from being confused between the custom kernel sysroot and the pre-installed one. [ Miguel: Applied Boqun's extra case (for `rusttest`) and reworded to add links to the arm64 patch series discussion. In addition, fixed the `rustdoc` target too (which requires a conditional since `cmd_rustdoc` is also used for host crates like `macros`). ]

Matthew Maurer committed 3 years ago

Commit 71479ee1 parent 88c2e112 files · +4 −0Browse files

Unified · Split

2 files
  1. rust/Makefile +3 −0
  2. scripts/Makefile.build +1 −0
rust/Makefile+3−0
@@ -78,6 +78,7 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $< · 77 unmodified lines
78 $(rustc_target_flags) -L$(objtree)/$(obj) \78 $(rustc_target_flags) -L$(objtree)/$(obj) \
79 --output $(rustdoc_output) \79 --output $(rustdoc_output) \
80 --crate-name $(subst rustdoc-,,$@) \80 --crate-name $(subst rustdoc-,,$@) \
81 $(if $(rustdoc_host),,--sysroot=/dev/null) \
81 @$(objtree)/include/generated/rustc_cfg $<82 @$(objtree)/include/generated/rustc_cfg $<
82 83
83# The `html_logo_url` and `html_favicon_url` forms of the `doc` attribute84# The `html_logo_url` and `html_favicon_url` forms of the `doc` attribute
@@ -178,6 +179,7 @@ quiet_cmd_rustdoc_test_kernel = RUSTDOC TK $< · 94 unmodified lines
178 --extern build_error --extern macros \179 --extern build_error --extern macros \
179 --extern bindings --extern uapi \180 --extern bindings --extern uapi \
180 --no-run --crate-name kernel -Zunstable-options \181 --no-run --crate-name kernel -Zunstable-options \
182 --sysroot=/dev/null \
181 --test-builder $(objtree)/scripts/rustdoc_test_builder \183 --test-builder $(objtree)/scripts/rustdoc_test_builder \
182 $< $(rustdoc_test_kernel_quiet); \184 $< $(rustdoc_test_kernel_quiet); \
183 $(objtree)/scripts/rustdoc_test_gen185 $(objtree)/scripts/rustdoc_test_gen
@@ -404,6 +406,7 @@ quiet_cmd_rustc_library = $(if $(skip_clippy),RUSTC,$(RUSTC_OR_CLIPPY_QUIET)) L · 220 unmodified lines
404 --emit=metadata=$(dir $@)$(patsubst %.o,lib%.rmeta,$(notdir $@)) \406 --emit=metadata=$(dir $@)$(patsubst %.o,lib%.rmeta,$(notdir $@)) \
405 --crate-type rlib -L$(objtree)/$(obj) \407 --crate-type rlib -L$(objtree)/$(obj) \
406 --crate-name $(patsubst %.o,%,$(notdir $@)) $< \408 --crate-name $(patsubst %.o,%,$(notdir $@)) $< \
409 --sysroot=/dev/null \
407 $(if $(rustc_objcopy),;$(OBJCOPY) $(rustc_objcopy) $@)410 $(if $(rustc_objcopy),;$(OBJCOPY) $(rustc_objcopy) $@)
408 411
409rust-analyzer:412rust-analyzer:
scripts/Makefile.build+1−0
@@ -275,6 +275,7 @@ rust_common_cmd = \ · 274 unmodified lines
275 --extern alloc --extern kernel \275 --extern alloc --extern kernel \
276 --crate-type rlib -L $(objtree)/rust/ \276 --crate-type rlib -L $(objtree)/rust/ \
277 --crate-name $(basename $(notdir $@)) \277 --crate-name $(basename $(notdir $@)) \
278 --sysroot=/dev/null \
278 --out-dir $(dir $@) --emit=dep-info=$(depfile)279 --out-dir $(dir $@) --emit=dep-info=$(depfile)
279 280
280# `--emit=obj`, `--emit=asm` and `--emit=llvm-ir` imply a single codegen unit281# `--emit=obj`, `--emit=asm` and `--emit=llvm-ir` imply a single codegen unit