Skip to content

Commit 9296969

Browse files
maurerfbq
authored andcommitted
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 uses `aarch64-unknown-none` rather than a target.json file, this is needed to prevent rustc from being confused between the custom kernel sysroot and the pre-installed one. Signed-off-by: Matthew Maurer <mmaurer@google.com> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Link: https://lore.kernel.org/r/20231031201752.1189213-1-mmaurer@google.com
1 parent 14a70e5 commit 9296969

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

rust/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ quiet_cmd_rustc_library = $(if $(skip_clippy),RUSTC,$(RUSTC_OR_CLIPPY_QUIET)) L
405405
--emit=metadata=$(dir $@)$(patsubst %.o,lib%.rmeta,$(notdir $@)) \
406406
--crate-type rlib -L$(objtree)/$(obj) \
407407
--crate-name $(patsubst %.o,%,$(notdir $@)) $< \
408+
--sysroot=/dev/null \
408409
$(if $(rustc_objcopy),;$(OBJCOPY) $(rustc_objcopy) $@)
409410

410411
rust-analyzer:

scripts/Makefile.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ rust_common_cmd = \
275275
--extern alloc --extern kernel \
276276
--crate-type rlib -L $(objtree)/rust/ \
277277
--crate-name $(basename $(notdir $@)) \
278+
--sysroot=/dev/null \
278279
--out-dir $(dir $@) --emit=dep-info=$(depfile)
279280

280281
# `--emit=obj`, `--emit=asm` and `--emit=llvm-ir` imply a single codegen unit

0 commit comments

Comments
 (0)