Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp7092486rwp; Tue, 18 Jul 2023 09:55:43 -0700 (PDT) X-Google-Smtp-Source: APBJJlHc+9gHsbBWD8ZiU466NnmTxNBDunU4AHMQzROBK2KZIhAr3KVpE0p6++/pgX8YEeG1e2ho X-Received: by 2002:a17:902:e5c1:b0:1b8:2ba0:c9a8 with SMTP id u1-20020a170902e5c100b001b82ba0c9a8mr386333plf.2.1689699343502; Tue, 18 Jul 2023 09:55:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689699343; cv=none; d=google.com; s=arc-20160816; b=Hc1mqzzQIAJAeT5FPYSRU06gF+MBIl1p8jcAkZZqVU7IvQBYJmyVl8PJ2AKHZ1KB0X N+nKnl5Po1lwpIVBUFqshRTdUf5m0UD7zR9SepSDWSGkK/EneGIBy9az1Md/m0popm45 jfZMPK77NCIVb0FCp8CGpjmcC4KD/jN80m1cTsSFjnIJqTFq0wB2mi6dpUR57XJuf+v+ gHf3kPcBN6tqqIzn6wxzpw+cCWPA9eUXNB0YtAv7Fj5QR6IqWQcNa25IZRjg70jDNfkG vvs/PJ/Kr/2X9xoev3FsCqctYnaySPO0FAso/bBuHpYJ94icaeJjHJdjAA3nU0Fpjpfe 652A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=jcSUTuIiogcXToLZh4DYCq2VidHpIqvlq6K4qoZxCc8=; fh=wutuq6Z7B/97nji8BXp5aflx/JV0ZvfPIp/TSmEVfrg=; b=fcqggmAoIQIOnJCRrDQpmwrS6b7wdayFJgIQo5rQ/TCSTvuZWUhtv0ZxtA9+Espvpj eWNpSeuz1HFQQWL2vVzG9g8xvpxmeAoWfOH/rKCNmrnBoWNJHT7sDB1J6dXN6oIDxkJM xSSyApHA3PRn3bd3LKUUWOu3pE1ygiRntQO0nMwitJtehDF1fM+CgGXy18q2UbEjcS8D xrZ8og9MrWh4nO9u2Etv0vzR+9GJH1p0LnH25KKw7dQdTMjmNbyhe01d+hrBeTsh2XRE SuXc9nTo3T+5dS+aP+DDeUZcyubcLkyIjnrb4OjGJTt75HB0I2A+dFzM/IzX5BcdY+Kx yCiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PM2FYJSN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id la14-20020a170902fa0e00b001bb1d822685si1833167plb.358.2023.07.18.09.55.30; Tue, 18 Jul 2023 09:55:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PM2FYJSN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231442AbjGRQnJ (ORCPT + 99 others); Tue, 18 Jul 2023 12:43:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230167AbjGRQnI (ORCPT ); Tue, 18 Jul 2023 12:43:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5398610C; Tue, 18 Jul 2023 09:43:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E5DB16167A; Tue, 18 Jul 2023 16:43:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D878C433C8; Tue, 18 Jul 2023 16:43:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689698586; bh=6GmurqX2i9JM34BQa9X30FmQHtnrur89oQ3WxbydzJo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PM2FYJSNOlfl7ajifO/Zb7gliIo6DLh1mRbpPrgh3TRoUhoZ6rlj70Lej34Ftn+AG NytoIB0ziTr1RxHoweF9CvObomaiakj6hnRjYm3NUbcmMWRfNJ7HtyDClA2v5P8XZm X4xajyR8KQeor6hPjr+IlvLImDEm6Hm3N4frcSeBH5QhHXH95p6YgWrjfyUqkej+RE 21SNU0aMQWNo+K01+12GvN0Up50PZYIR9v23LinCvoOrGh8w916WIZ3kQjRQbix0Ou ld8g8iYvORM3N/IGSc0R/KuItkXyIpRuoiEhI1S6Q8VaNrBIBdYw2tqjia3OBybawT R4nsCEcyw1haA== Date: Tue, 18 Jul 2023 09:43:03 -0700 From: Nathan Chancellor To: Miguel Ojeda Cc: Masahiro Yamada , Wedson Almeida Filho , Alex Gaynor , Nick Desaulniers , Nicolas Schier , Boqun Feng , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Benno Lossin , Alice Ryhl , Andreas Hindborg , linux-kbuild@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Raphael Nestler , Andrea Righi , stable@vger.kernel.org Subject: Re: [PATCH] kbuild: rust: avoid creating temporary files Message-ID: <20230718164303.GB1279879@dev-arch.thelio-3990X> References: <20230718055235.1050223-1-ojeda@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230718055235.1050223-1-ojeda@kernel.org> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 18, 2023 at 07:52:35AM +0200, Miguel Ojeda wrote: > `rustc` outputs by default the temporary files (i.e. the ones saved > by `-Csave-temps`, such as `*.rcgu*` files) in the current working > directory when `-o` and `--out-dir` are not given (even if > `--emit=x=path` is given, i.e. it does not use those for temporaries). > > Since out-of-tree modules are compiled from the `linux` tree, > `rustc` then tries to create them there, which may not be accessible. > > Thus pass `--out-dir` explicitly, even if it is just for the temporary > files. > > Reported-by: Raphael Nestler > Closes: https://github.com/Rust-for-Linux/linux/issues/1015 > Reported-by: Andrea Righi > Tested-by: Raphael Nestler > Tested-by: Andrea Righi > Cc: stable@vger.kernel.org > Signed-off-by: Miguel Ojeda Seems reasonable to me. Reviewed-by: Nathan Chancellor > --- > scripts/Makefile.build | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/scripts/Makefile.build b/scripts/Makefile.build > index 6413342a03f4..82e3fb19fdaf 100644 > --- a/scripts/Makefile.build > +++ b/scripts/Makefile.build > @@ -264,6 +264,9 @@ $(obj)/%.lst: $(src)/%.c FORCE > > rust_allowed_features := new_uninit > > +# `--out-dir` is required to avoid temporaries being created by `rustc` in the > +# current working directory, which may be not accessible in the out-of-tree > +# modules case. > rust_common_cmd = \ > RUST_MODFILE=$(modfile) $(RUSTC_OR_CLIPPY) $(rust_flags) \ > -Zallow-features=$(rust_allowed_features) \ > @@ -272,7 +275,7 @@ rust_common_cmd = \ > --extern alloc --extern kernel \ > --crate-type rlib -L $(objtree)/rust/ \ > --crate-name $(basename $(notdir $@)) \ > - --emit=dep-info=$(depfile) > + --out-dir $(dir $@) --emit=dep-info=$(depfile) > > # `--emit=obj`, `--emit=asm` and `--emit=llvm-ir` imply a single codegen unit > # will be used. We explicitly request `-Ccodegen-units=1` in any case, and > > base-commit: 06c2afb862f9da8dc5efa4b6076a0e48c3fbaaa5 > -- > 2.41.0 >