From nobody Wed Dec 31 16:19:32 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C6DDC4167D for ; Tue, 31 Oct 2023 20:18:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232664AbjJaUSW (ORCPT ); Tue, 31 Oct 2023 16:18:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231719AbjJaUSU (ORCPT ); Tue, 31 Oct 2023 16:18:20 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 718C9ED for ; Tue, 31 Oct 2023 13:18:18 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-5a7b9e83b70so1994267b3.0 for ; Tue, 31 Oct 2023 13:18:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698783497; x=1699388297; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=ztq39AVKtcPBQkDEgvD9lSUG5ylL2QPNBxZOTT2U9hc=; b=EGHI4CJywkrKHWz4oREJwLIPp6QyfyEiQeyA23EfZYk0zf+UB8FaTgGtnIX4Yz/5zq 0wfaPxBX7kOFTa7t8SErD2Hdr9/BpS/09YMO+DydsO14aCCNLpEF5gRDbAdvSyeOlVqc UPdwDfxNFzQZxJxlIYSyVEJZg41aUPEyzyBuf8phKhuMelMvnPjr5Pz6KgLXeK4ZyOyT +hM/LYAkG4A9YLNg1vZwyyDl7cXlnZ1Ny2Pzc8JTvWpSyKt02vk6NaI7jNgmL1ZlNAAc 3b2rz5CYEcRrjjIGqzCRVZFOm/ke01G8uUhp01YYpIQ64333Vi174EbMtHL1aCTM9ObF psUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698783497; x=1699388297; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=ztq39AVKtcPBQkDEgvD9lSUG5ylL2QPNBxZOTT2U9hc=; b=CY7v1a2zrJvTFDFvtXIPFrM9j3EekomGA8HMFL7acqt10EIi/DH3j0QoHHjhnN36jF PUGv2reDlG+LuFdKwccFrA1OiB39bMGuocxB6fSHE2Qjo9GOVY5oB8VT9OSbmo1T+Lvb 1/1UrsBIVq5wHjbO0ruhx6hxxG02YNEZSEhnrEgUFPq3vCA1aQrzJ47pQYiIvnr7yHvs H8TlmHh1UiUkYKT+aplX6SUnd7UJQSW+ovEsLMY+heikC6wJKgFmCso+TC/TL4uGOFsR GUbh4p8IuMKE4yO7oFlDu9GQJabWVO/6IM8xPzg64D6+htpLmSj8pb5cRTPhlZ4tqGfQ bPww== X-Gm-Message-State: AOJu0Yx56h9sIBOTiF064b5aGfztW7M9KE9DVgAIprDHQHALlceoGL1M PDjpu8GoAPARDQjOiGafhk82V6FLs4ZG X-Google-Smtp-Source: AGHT+IE8r9R0/YNE2aMmXBt/5jdVEq82GPS8cQwktw+16arRhB9NYq/NvvqS8Dt8j29bFV2jrKzq4QjdO3vj X-Received: from anyblade.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:1791]) (user=mmaurer job=sendgmr) by 2002:a0d:d684:0:b0:58c:e8da:4d1a with SMTP id y126-20020a0dd684000000b0058ce8da4d1amr89719ywd.2.1698783497681; Tue, 31 Oct 2023 13:18:17 -0700 (PDT) Date: Tue, 31 Oct 2023 20:10:14 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.42.0.820.g83a721a137-goog Message-ID: <20231031201752.1189213-1-mmaurer@google.com> Subject: [PATCH] rust: Suppress searching builtin sysroot From: Matthew Maurer To: Jamie.Cunliffe@arm.com, Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Masahiro Yamada Cc: will@kernel.org, Matthew Maurer , Boqun Feng , Gary Guo , "=?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?=" , Benno Lossin , Andreas Hindborg , Alice Ryhl , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" By default, if Rust is passed `--target=3Dfoo` 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 Reviewed-by: Alice Ryhl Tested-by: Boqun Feng --- This patch is prompted by the issue I encountered at https://lore.kernel.org/all/CAGSQo01pOixiPXkW867h4vPUaAjtKtHGKhkV-rpifJvKxA= f4Ww@mail.gmail.com/ but should be generically more hermetic even if we don't end up landing that patch. rust/Makefile | 1 + scripts/Makefile.build | 1 + 2 files changed, 2 insertions(+) diff --git a/rust/Makefile b/rust/Makefile index a27f35f924ec..0403e88e19fd 100644 --- a/rust/Makefile +++ b/rust/Makefile @@ -400,6 +400,7 @@ quiet_cmd_rustc_library =3D $(if $(skip_clippy),RUSTC,$= (RUSTC_OR_CLIPPY_QUIET)) L --emit=3Dmetadata=3D$(dir $@)$(patsubst %.o,lib%.rmeta,$(notdir $@)) \ --crate-type rlib -L$(objtree)/$(obj) \ --crate-name $(patsubst %.o,%,$(notdir $@)) $< \ + --sysroot=3D/dev/null \ $(if $(rustc_objcopy),;$(OBJCOPY) $(rustc_objcopy) $@) =20 rust-analyzer: diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 82e3fb19fdaf..6e4ee513cc3c 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -275,6 +275,7 @@ rust_common_cmd =3D \ --extern alloc --extern kernel \ --crate-type rlib -L $(objtree)/rust/ \ --crate-name $(basename $(notdir $@)) \ + --sysroot=3D/dev/null \ --out-dir $(dir $@) --emit=3Ddep-info=3D$(depfile) =20 # `--emit=3Dobj`, `--emit=3Dasm` and `--emit=3Dllvm-ir` imply a single cod= egen unit --=20 2.42.0.820.g83a721a137-goog