Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4852322rdb; Fri, 15 Sep 2023 14:33:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEUUDmiJlXpAYmF8fXQOy3fEodlb7yIqhtg7yGwKLQk987ry8dh1AiRvWTQQvN8e/2Exp0i X-Received: by 2002:a17:90a:d194:b0:268:314f:8f35 with SMTP id fu20-20020a17090ad19400b00268314f8f35mr2673495pjb.6.1694813584483; Fri, 15 Sep 2023 14:33:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694813584; cv=none; d=google.com; s=arc-20160816; b=Ufwhx+wIEMCuMuF4i2/oR8VrYIn/sJCzCVjgu9JkXoBasSQToHtx+2VToe5Mm2BlCr ZKICQwWQRh6iMr6gum5xBcyKRgTdl5z02z56Kw3ebW2EHgEtrv+R5OKOA72ZJRJS5Z1U zXRNp39Y7iYvwsv5OKzNBiIYj5Yw7B1MICo0r1ti7YVWh7RrMi6cQ+FZU3nWJWbsUHdt esuheFZZp7X13zRoTgIUofKLNIPK5EYRbKP+nCSWcC7+vkgpVMsAhjYBaXBMlFgGfWSN 7NLfNeHLCDtD+dHwiCekUlKYd0Dv68bKvCrEZ41Z9TtviUM6Ao4tw2+gkW1NPOwqNe3d zrJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version:date :dkim-signature; bh=ugRbSrKZTgJSxFp7tilsZX/7onhJCvgcZOqxi5h8ayg=; fh=BiRaoiZOuCBl9aVvgbMWX++ubMpiO+22FRY+ngyKD9Q=; b=oVZbklEA0x4ZRdOz20shXYGAVcwn+QEHcG9gjh3U4iFhwyYuTdGRd93NvQMUcQjGrp SaQ5TlLfNmRGoezn0HzWJ2MAIIi83dqwQNThLawuJhQQUbeO5qfhecilVT38Pb4tkEfJ V/7cUv18L1MKY1meZHbvHG31jT0PW2zkrMYQks/qyyIYKB+RywW0Zv/JGjp+2GJ+85zG QfeQ6YJCD9g+NYr4z6tqTy44UIRwkpfcOB8VIhIUYVtBixqtFdxlvGV6MpwpRR87y99h OmY3aAciF48/wWI0nzKpXJ7PYChSiABMb80YdvzLtjzdHsdOF5zv+1Fa1Sq1nuLlYAJV csPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=CCEyGmuh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id ob14-20020a17090b390e00b00268137c2f12si731447pjb.2.2023.09.15.14.32.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 14:33:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=CCEyGmuh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 6874C82FCEAA; Fri, 15 Sep 2023 10:30:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235995AbjIOR3j (ORCPT + 99 others); Fri, 15 Sep 2023 13:29:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235908AbjIOR3K (ORCPT ); Fri, 15 Sep 2023 13:29:10 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B1E32111 for ; Fri, 15 Sep 2023 10:29:05 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-59bee08c13aso26010727b3.0 for ; Fri, 15 Sep 2023 10:29:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1694798944; x=1695403744; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=ugRbSrKZTgJSxFp7tilsZX/7onhJCvgcZOqxi5h8ayg=; b=CCEyGmuhfPYEztnD5W2Nu2CDNu97X+FKzI8WTKQFUhrwtK8CfaGC5kgapgQpJNOSpa mR5p9TLH+ZXpJT9LSNhYQH88anpMZNSmxZisvSX7Hee8bJuwyo5gCZ6THUg+T1tyaq7W e/ll9z1VM5VlLBgb40xi7fAHfsPCIOzF2YX6K9S/7dbDU5w+boDeClGXq4noOa6NzdWN yoVHKPxAURerr/j8P+0XrEe+DwaOgcJzbkVRHz4wzN4NqyxgxqMqN1cM0Tt4kAGGzmId SoTsulKiEiSQ+3lt7uljupkkyeE/mnRhpNqu6NevQGpkrCNDnpQYEic8LJ012guITvuy JAng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694798944; x=1695403744; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=ugRbSrKZTgJSxFp7tilsZX/7onhJCvgcZOqxi5h8ayg=; b=Xc8Ryeh2SsqJXnBPg9MCxVcVibHOTyGR8TRYbrfslpF3Qip7BVzic0ujfx0ldO1c4j yBQDRJu6h/HA2aCuwntt0KbV9Qe9brxOav67WSsKvjIEhdR5c5eusjS87Po8hANATOnO gCd7HJJRIfSoDeoMqFMXH0udXPnWOtkyaHe2gxt8hNcBQEDb8WyXU42LU3yeAy5WtPrB hmTRl47aiAAwjh3lYkENMdyZpWf+C/3cazE60py8uTy3/wSCsOUSqnrOOXyk+LDfYBfi fVkKKkRphwsI+lACoFsdnF18JOpFeoiwUrOpoxynqYxiP5QL2/xMav11KwZLWFm0AY1J w4zw== X-Gm-Message-State: AOJu0YwE23en2d9lojEtayar98qIyt5sdV5xXynvA0kZWCzOKB+E6ezV ZzNHS+s7xIujIYkLKMn998F3/7CHe4L4 X-Received: from anyblade.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:1791]) (user=mmaurer job=sendgmr) by 2002:a81:a78a:0:b0:583:4f82:b9d9 with SMTP id e132-20020a81a78a000000b005834f82b9d9mr73272ywh.5.1694798944470; Fri, 15 Sep 2023 10:29:04 -0700 (PDT) Date: Fri, 15 Sep 2023 17:28:59 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.42.0.459.ge4e396fd5e-goog Message-ID: <20230915172900.3784163-1-mmaurer@google.com> Subject: [PATCH] rust: Respect HOSTCC when linking for host From: Matthew Maurer To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Masahiro Yamada Cc: 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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Fri, 15 Sep 2023 10:30:12 -0700 (PDT) Currently, rustc defaults to invoking `cc`, even if `HOSTCC` is defined, resulting in build failures in hermetic environments where `cc` does not exist. This includes both hostprogs and proc-macros. Since we are setting the linker to `HOSTCC`, we set the linker flavor to `gcc` explicitly. 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 = $(RUSTC_OR_CLIPPY_QUIET) P $@ cmd_rustc_procmacro = \ $(RUSTC_OR_CLIPPY) $(rust_common_flags) \ + -C linker-flavor=gcc -C linker=$(HOSTCC) \ --emit=dep-info=$(depfile) --emit=link=$@ --extern proc_macro \ --crate-type proc-macro \ --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 = -Wp,-MMD,$(depfile) \ # current working directory, which may be not accessible in the out-of-tree # modules case. hostrust_flags = --out-dir $(dir $@) --emit=dep-info=$(depfile) \ + -C linker-flavor=gcc -C linker=$(HOSTCC) \ $(KBUILD_HOSTRUSTFLAGS) $(HOST_EXTRARUSTFLAGS) \ $(HOSTRUSTFLAGS_$(target-stem)) -- 2.42.0.459.ge4e396fd5e-goog