Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp1844469pxy; Mon, 2 Aug 2021 11:41:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxksix3t7w2ukW4OxF9CcIchsAVhngEIXSIFXjHy7FHqC7ORZEHIbquL44Gnrvevg09HJ9C X-Received: by 2002:a05:6e02:54c:: with SMTP id i12mr2294113ils.103.1627929694759; Mon, 02 Aug 2021 11:41:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627929694; cv=none; d=google.com; s=arc-20160816; b=sbcfUYtxMmJNFvkEpipYz8BVDt5tKTdvbAuKhLl9kRVWgggENPYUqbu+TAVkboReOJ 7/tBWpI8/bW+9XkTY0aEwej/2pOzd81f+jRDIOXztfjv/MJ+lxLWV3U4JlmlGXHwzL0B Vkj8ECl4bMz172vHketpKR7+hknVYAKXgJVUVyy56/qpbIgGtEYUkb4Z9rFm/LvZkpjt OxOsxUo1njAsp641/bx9ZhCtF+YH0uD5fMmeV4SsaL2lttaNNpL+xpMM6BYXPUpmzr4w rOfrH15LEuWaX6E6XQ8UZ0yy/xeSVH+wNdkB7JeTTVQvA3YbWV1jXAKuwRoy0MqrrBUb DfXQ== 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:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=kxeZ499IZ34ScBxCoMfNAW68U3dStYlxpnDRACL6igo=; b=DMC8sKLKpINXyVS/F9Bn7NMg87vvweJlWqXZU2dmY5FRXZorY+hFE8atij893bfsRe 6PnAJE/qpLJu0s9eVPF2QHW+vCEP/Z/DBbyhckqjyUI7GCK+DsQZzm2oubaOh62uGoLR vRizXFwdbiyLYv6+ysGbOYzIAK/Vs39gOA1OHVzmvMIqiLyGbd4cXecgHHqV0yjJHYgU UFe4VKcldAvb3LX1xDBrpA+gofOql5xOLAzzEdR9ql8W12t5LydjdRHQSsmLpCpxJUlO Qfv4lioySOAysvSPAL8wOLWTN/LfK4pLYS0VwhGPuHAlcZLnSvg0AiOI4Dj9fbiRHH7K nuiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=UDtO0O6r; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y11si16106265ilu.1.2021.08.02.11.41.22; Mon, 02 Aug 2021 11:41:34 -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=@google.com header.s=20161025 header.b=UDtO0O6r; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229847AbhHBSji (ORCPT + 99 others); Mon, 2 Aug 2021 14:39:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230401AbhHBSje (ORCPT ); Mon, 2 Aug 2021 14:39:34 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C72C4C0613D5 for ; Mon, 2 Aug 2021 11:39:24 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id f3-20020a25cf030000b029055a2303fc2dso19987340ybg.11 for ; Mon, 02 Aug 2021 11:39:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=kxeZ499IZ34ScBxCoMfNAW68U3dStYlxpnDRACL6igo=; b=UDtO0O6rkVrtHHJ0SY0aJGfDOIrgTELa5pL49JkakQig4VEH4F1RYPBtFkzclcT1AW 3PYpRFCoePQetkTDZL+0BrzS8/HVZxoo3wrAfaXiYGNEjJjkjR+Lre0Z/trVZs8EOrvE xPjy1vqLoQfm3SdKS6zR92Rcz8ZeeCJi1mnhoMXiR5Kefvq5XTnqWPAF538d0TmdybiM WAxHashTaJSGdc3V0M7MnMsaLgYpLGV8PnWc95a3yhi4twIkoMJyHTee6JOPjOxtnWms ZDgytj6HYE24k3Hd02+cJBlh6WcUtHK35hdESUs3xtAkQDy8TTjgHRXBAxVi4MdOArRh BPCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=kxeZ499IZ34ScBxCoMfNAW68U3dStYlxpnDRACL6igo=; b=mbALUJwzXbPvnETjlsQe5oPjkGPHRDGzZTIEjYKMp1uxeM2TtCkGxET6vHoJ53qMfr T32R7nf/Mt9tiivDKA3DEMq2mafzTn/OEr4EqZM49Hh9E9BZJ8Wx+Bii+reD531sCAhD B1KaQ1cQTpYkohXKAh+VQFdt2gInHzdtEAJ3I70H6NsHjn9U2Is4yLT1ThUnZ4oOonWe A92SayoOAJfk/0J/Zy/wvUChkm173J6J39gNLRZNGuWmlxkZ9t78qhQjhHjuqhvLaIrd TyrySUZTB959O69RrcUFnrSzGsBnz/gR9OYWUQDrqkJpFulafRFPfK3uEhMF+Dw3fVi/ sPUQ== X-Gm-Message-State: AOAM532Pl3+ZpwwRHJkvlSbLl8VBzfVxMQ/q2uTkjuWhfPeGAdmSUgxO 3MzU6UsqY6bJrXioOJXzBr5fErF/cdj7Rfve/ws= X-Received: from ndesaulniers1.mtv.corp.google.com ([2620:15c:211:202:3db0:42c:8665:a4ae]) (user=ndesaulniers job=sendgmr) by 2002:a25:320f:: with SMTP id y15mr22007134yby.515.1627929564059; Mon, 02 Aug 2021 11:39:24 -0700 (PDT) Date: Mon, 2 Aug 2021 11:39:10 -0700 In-Reply-To: <20210802183910.1802120-1-ndesaulniers@google.com> Message-Id: <20210802183910.1802120-4-ndesaulniers@google.com> Mime-Version: 1.0 References: <20210802183910.1802120-1-ndesaulniers@google.com> X-Mailer: git-send-email 2.32.0.554.ge1b32706d8-goog Subject: [PATCH v6 3/3] Documentation/llvm: update CROSS_COMPILE inferencing From: Nick Desaulniers To: Masahiro Yamada Cc: Miguel Ojeda , Fangrui Song , Michal Marek , Arnd Bergmann , linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, clang-built-linux@googlegroups.com, Geert Uytterhoeven , Christoph Hellwig , Linus Torvalds , Nick Desaulniers Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. + +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