Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp5400174rdb; Sat, 16 Sep 2023 15:52:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGLhr3MAfhNSOt6OudDKxV6lYLVwpGfmmcSBw57ZELkkPfiZ3/o3Mu71G18yVsCpSbYgA9S X-Received: by 2002:a05:6a21:6d97:b0:133:be9d:a9e6 with SMTP id wl23-20020a056a216d9700b00133be9da9e6mr7247574pzb.17.1694904729249; Sat, 16 Sep 2023 15:52:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694904729; cv=none; d=google.com; s=arc-20160816; b=I0JHGeeeYF6i6CXkCcsXvf8fc+TB36LFTPdoavaVfwzeoYvSvTQt9ndeHf704aQaN3 9u3uA4iKwRoBXTohkQ5RT4tr1V3ggzpATOK3TnJBV7T7bLZkXdirH1H6xt+udfX+WWGv 1ptkZGX4oaubp01+dsJRdqAIWw9IASTqvoMBsXvUm5Fp8HzqZ+dJXajU27kauRA7wSjc 8Pqs+JU4leGciLlhHSiBAt1RWVsRpf18kilVZo1r+wrGY7qyuUlrPrbfD3yBwZ9LGWjA iNcgejz4VkDGks3+Sagi0KNFql9MaWYHOOvrel5lltWXLU9FefCUjKTKOF/rISnYPLcD DfNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :feedback-id:references:in-reply-to:message-id:subject:cc:from:to :date:dkim-signature; bh=Utb7hBOVxc/ZFn0MMOWNFNa55EwwLJ9JMnuohv777VQ=; fh=Ga/C/kuNYcbxyauSAsk2yz61iZN1wU1NdxQNLCPPTi8=; b=cciVcCCTF2YMLXua5Y2NzygZHNnPurT9udLL33Gv5LBj2Z1g/ZDD/ByDlGe+YsUwQn /lqFiNAQnAevbDbw98ZXdd3bEce8cnXyjt6AFSgte/3YZ5weGAVtVrs1ulXvuavL7wDI MMT/RuLLISH1tyljsabZ+VVxaMWulsPiTjlAz/4YSaxRBtCZxHHciIDsbvF3E6G4kKQU BgIgelUZkwg23LgGCtFjaETYRFHMzNY8qmwwmBEfBOaXHOttKPAsrOUkZ+HDgMkXfgI6 uip4MEPkxHuAT2u3RH2vYibqUiS3pDhnT+XjIXp+JbxkWp9lVo4Pj01+UMD7RssICcQx XB4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@protonmail.com header.s=protonmail3 header.b=cqrArCzh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id t21-20020a639555000000b00578005041b7si4743328pgn.294.2023.09.16.15.52.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Sep 2023 15:52:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@protonmail.com header.s=protonmail3 header.b=cqrArCzh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 614FC83896F9; Sat, 16 Sep 2023 11:01:40 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233902AbjIPRyA (ORCPT + 99 others); Sat, 16 Sep 2023 13:54:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236463AbjIPRxg (ORCPT ); Sat, 16 Sep 2023 13:53:36 -0400 Received: from mail-0201.mail-europe.com (mail-0201.mail-europe.com [51.77.79.158]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4752418D for ; Sat, 16 Sep 2023 10:53:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1694886803; x=1695146003; bh=Utb7hBOVxc/ZFn0MMOWNFNa55EwwLJ9JMnuohv777VQ=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=cqrArCzhFcgQZsen0K2oFKA+zYxyuqficq4GoKKVywYLanUOBlxHyE5X5r283U3zX KkmwyWC4zr0ko5ulI/bemoo3G+7DVmFRxBySe4WRhOb8KoWaNJacuxkz38/n9vfYpy AxEWQGsdwM/dAAOgEzO5eiiWJEFW06e/vVd2chnaGyKOHXnjLyWvdsW+cOKEXym004 swrKr/jupAqU3LA57t5HsMVmJkUvotKGEcaC6YhK4/1ivX43p7AAdpwVCWtVn6WMJy XSV3Rv+yyAfYu4sBI/Q+4KvchImHeS6OREB0ZbCw7e1Vt9Kd7+CeWRLHuZSW9JBbSz 4MvkDo6rZF+kQ== Date: Sat, 16 Sep 2023 17:53:03 +0000 To: Finn Behrens From: =?utf-8?Q?Bj=C3=B6rn_Roy_Baron?= Cc: Matthew Maurer , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Masahiro Yamada , Boqun Feng , Gary Guo , 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 Subject: Re: [PATCH] rust: Respect HOSTCC when linking for host Message-ID: In-Reply-To: <9966E047-44E7-4665-9628-169F3EBE2F06@kloenk.dev> References: <20230915172900.3784163-1-mmaurer@google.com> <9966E047-44E7-4665-9628-169F3EBE2F06@kloenk.dev> Feedback-ID: 27884398:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sat, 16 Sep 2023 11:01:40 -0700 (PDT) On Saturday, September 16th, 2023 at 18:52, Finn Behrens wr= ote: >=20 > On 15 Sep 2023, at 19:28, Matthew Maurer wrote: >=20 > > Currently, rustc defaults to invoking `cc`, even if `HOSTCC` is defined= , > > resulting in build failures in hermetic environments where `cc` does no= t > > exist. This includes both hostprogs and proc-macros. > > > > Since we are setting the linker to `HOSTCC`, we set the linker flavor t= o > > `gcc` explicitly. > But as `HOSTCC` could also be clang, the linker flavor would then be wron= g, would that create a problem? Rustc uses the gcc linker flavor for clang too. There has been a proposal t= o split it up, but I'm not sure of the status of that. In any case clang's = cli is similar enough to gcc that it works fine to use the gcc linker flavo= r. > > > > Signed-off-by: Matthew Maurer > > --- > > rust/Makefile | 1 + > > scripts/Makefile.host | 1 + > > 2 files changed, 2 insertions(+) > > > > diff --git a/rust/Makefile b/rust/Makefile > > index 87958e864be0..2a2352638f11 100644 > > --- a/rust/Makefile > > +++ b/rust/Makefile > > @@ -383,6 +383,7 @@ $(obj)/exports_kernel_generated.h: $(obj)/kernel.o = FORCE > > quiet_cmd_rustc_procmacro =3D $(RUSTC_OR_CLIPPY_QUIET) P $@ > > cmd_rustc_procmacro =3D \ > > =09$(RUSTC_OR_CLIPPY) $(rust_common_flags) \ > > +=09=09-C linker-flavor=3Dgcc -C linker=3D$(HOSTCC) \ > > =09=09--emit=3Ddep-info=3D$(depfile) --emit=3Dlink=3D$@ --extern proc_= macro \ > > =09=09--crate-type proc-macro \ > > =09=09--crate-name $(patsubst lib%.so,%,$(notdir $@)) $< > > diff --git a/scripts/Makefile.host b/scripts/Makefile.host > > index 8f7f842b54f9..0aa95a3af1c4 100644 > > --- a/scripts/Makefile.host > > +++ b/scripts/Makefile.host > > @@ -91,6 +91,7 @@ hostcxx_flags =3D -Wp,-MMD,$(depfile) \ > > # current working directory, which may be not accessible in the out-of= -tree > > # modules case. > > hostrust_flags =3D --out-dir $(dir $@) --emit=3Ddep-info=3D$(depfile) = \ > > +=09=09 -C linker-flavor=3Dgcc -C linker=3D$(HOSTCC) \ > > $(KBUILD_HOSTRUSTFLAGS) $(HOST_EXTRARUSTFLAGS) \ > > $(HOSTRUSTFLAGS_$(target-stem)) > > > > -- > > 2.42.0.459.ge4e396fd5e-goog