Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp621922pxt; Thu, 5 Aug 2021 07:47:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyym8E2MAsI8lMOrJ4CIJxShC5wXTRXNmdLkxJcO+4vUYI362cZp1yqpMrF0OVjn/DQqrpl X-Received: by 2002:a05:6402:95a:: with SMTP id h26mr6993011edz.109.1628174851678; Thu, 05 Aug 2021 07:47:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628174851; cv=none; d=google.com; s=arc-20160816; b=ywSOMNxsjXokpUNujpeItzVbfTkUvejyjVa82o+j+pzLitRvoLydmCv1Yodtdl8BwL I6MwQPjjbMaYDg2XJw9vsUsVRv9I3E5ZCV0LIN7LFIOJDbv3YoTRZ5Lbnh+hNscsnMF3 HyxGx7LJYI/IKgLxFdfInmq/Kb8aEXTRfiBaCBu3CCkYm0TTRLmQEm/7feuCfqQWBUQl 7dL6x41/LHLmK9Q4ktJjaJH497T+5d2+QJPknmbvuTJJnzTd2Yw2tI5msz4FwWgqH5oT OA/tSd6L5TQ/g56W5lLAqKTw2a0qtHhl0wiulrKhLVyk9+R5fUjfDzBc9qkFjMkN3l7l yH7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature:dkim-filter; bh=IkfSllG+SbN/b97YNpBIEYdvlpJTUqg6G4RBryizSqQ=; b=X4LXNZsGz29oNe5OJr9MKv8kBQK8zXW4DURwhd1c8xAoNmBYC2yTcEK4a3hqfDjXYq vMpTD8AWJ/7aFUi1cifJeUyoJa6GbIoqGwD7GzP8VJ3nVQk/gN89GeKz9pYD7N7mZy3u CmnCJoC4/kbhmjAUtfPo8WIdqR0yvcSz1EfRXIxyQypF8O6z9hWv3ml4oqV33HxAKtBm eWF/NdMIrY/MD2qJvFi1OxtlM7/mZMKdPJyNiwovzsHPmZiamfvQaFSkuvPpDhEvldph CfRm6LKIHyifF5TlK50NIl4IcFQ/BKRiPmSq7TW31xPh7ljvifRMXLhN+QEHGbTfJ7kb BVGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=ua05HcSe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w4si5533569edd.535.2021.08.05.07.47.08; Thu, 05 Aug 2021 07:47:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=ua05HcSe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S240169AbhHEN6z (ORCPT + 99 others); Thu, 5 Aug 2021 09:58:55 -0400 Received: from conssluserg-03.nifty.com ([210.131.2.82]:57078 "EHLO conssluserg-03.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239757AbhHEN6y (ORCPT ); Thu, 5 Aug 2021 09:58:54 -0400 Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) (authenticated) by conssluserg-03.nifty.com with ESMTP id 175DwLoB003434; Thu, 5 Aug 2021 22:58:22 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-03.nifty.com 175DwLoB003434 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1628171902; bh=IkfSllG+SbN/b97YNpBIEYdvlpJTUqg6G4RBryizSqQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ua05HcSeJ4GvTVEoegvZ/4UovWLE4o04xLtcLEgmKUiat7MByY6JV9RYXC/BKRqZq bJ4GEPmNqOAS2we1MhN7g2DxlhTz/V4qJD2aRoup0IgEmSO0tEY7gz1pBFum+zt+fp BOr/AGtvqAMKEfR26wckN+FCI1/Po8YmaWbo5d0BoDhxEOQQMNcXfrKHpmzGShwmsw UajyYRmcA9TkCLDMwRip4TPZBuIr9STIhvQQHCSpw7ZHQN9LVNcFreo9oITw7vblks WupTlOpeIMuKYqZJIXAS9raVZft2wpAWW8iCRkt4Fb6XXw5ss8b4iDTGtm+oXNk+fC AkMsXX4WMYfRQ== X-Nifty-SrcIP: [209.85.216.47] Received: by mail-pj1-f47.google.com with SMTP id m10-20020a17090a34cab0290176b52c60ddso9609585pjf.4; Thu, 05 Aug 2021 06:58:22 -0700 (PDT) X-Gm-Message-State: AOAM530KqEPsaudEQ14PYggWt4dztn33bJnmHVy1Z4mrraPBsuBXX01/ mJcaHXAaYvBiCDJbyOGMjYpl1oYfNrW+XBcheY0= X-Received: by 2002:a17:90a:c506:: with SMTP id k6mr15434358pjt.198.1628171901401; Thu, 05 Aug 2021 06:58:21 -0700 (PDT) MIME-Version: 1.0 References: <20210802183910.1802120-1-ndesaulniers@google.com> <20210802183910.1802120-4-ndesaulniers@google.com> In-Reply-To: <20210802183910.1802120-4-ndesaulniers@google.com> From: Masahiro Yamada Date: Thu, 5 Aug 2021 22:57:44 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v6 3/3] Documentation/llvm: update CROSS_COMPILE inferencing To: Nick Desaulniers Cc: Miguel Ojeda , Fangrui Song , Michal Marek , Arnd Bergmann , Linux Kernel Mailing List , Linux Kbuild mailing list , clang-built-linux , Geert Uytterhoeven , Christoph Hellwig , Linus Torvalds Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 3, 2021 at 3:39 AM 'Nick Desaulniers' via Clang Built Linux wrote: > > As noted by Masahiro, document how we can generally infer CROSS_COMPILE > (and the more specific details about --target and --prefix) based on > ARCH. > > Change use of env vars to command line parameters. > > Suggested-by: Masahiro Yamada > Reviewed-by: Fangrui Song > Signed-off-by: Nick Desaulniers > --- > Changes v5 -> v6: > * Pick up Fangrui's RB tag. > * Change use of env vars to command line parameters for consistency. > > Documentation/kbuild/llvm.rst | 19 ++++++++++++++++++- > 1 file changed, 18 insertions(+), 1 deletion(-) > > diff --git a/Documentation/kbuild/llvm.rst b/Documentation/kbuild/llvm.rst > index b18401d2ba82..f8a360958f4c 100644 > --- a/Documentation/kbuild/llvm.rst > +++ b/Documentation/kbuild/llvm.rst > @@ -38,7 +38,7 @@ Cross Compiling > A single Clang compiler binary will typically contain all supported backends, > which can help simplify cross compiling. :: > > - ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make CC=clang > + make ARCH=arm64 CC=clang CROSS_COMPILE=aarch64-linux-gnu- > > ``CROSS_COMPILE`` is not used to prefix the Clang compiler binary, instead > ``CROSS_COMPILE`` is used to set a command line flag: ``--target=``. For > @@ -63,6 +63,23 @@ They can be enabled individually. The full list of the parameters: :: > Currently, the integrated assembler is disabled by default. You can pass > ``LLVM_IAS=1`` to enable it. > > +Omitting CROSS_COMPILE > +---------------------- > + > +As explained above, ``CROSS_COMPILE`` is used to set ``--target=``. > + > +Unless ``LLVM_IAS=1`` is specified, ``CROSS_COMPILE`` is also used to derive > +``--prefix=`` to search for the GNU assembler and linker. Is there any place where we rely on --prefix to search for the linker? In general, the compiler stops after generating an object since it is passed with the -c option. The linking stage is separated. In the old days, VDSO was an exceptional case where $(CC) was used as the linker driver, but commit fe00e50b2db8c60e4ec90befad1f5bab8ca2c800 fixed it. > + > +If ``CROSS_COMPILE`` is not specified, the ``--target=`` is inferred > +from ``ARCH``. > + > +That means if you use only LLVM tools, ``CROSS_COMPILE`` becomes unnecessary. > + > +For example, to cross-compile the arm64 kernel:: > + > + make ARCH=arm64 LLVM=1 LLVM_IAS=1 > + > Supported Architectures > ----------------------- > > -- > 2.32.0.554.ge1b32706d8-goog > > -- > You received this message because you are subscribed to the Google Groups "Clang Built Linux" group. > To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20210802183910.1802120-4-ndesaulniers%40google.com. -- Best Regards Masahiro Yamada