From nobody Sun Jun 28 02:50:41 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B828C433F5 for ; Tue, 15 Feb 2022 20:49:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244171AbiBOUuH (ORCPT ); Tue, 15 Feb 2022 15:50:07 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:37822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236924AbiBOUuD (ORCPT ); Tue, 15 Feb 2022 15:50:03 -0500 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E61B0BC11 for ; Tue, 15 Feb 2022 12:49:51 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id b187-20020a251bc4000000b0061e15c5024fso42976953ybb.4 for ; Tue, 15 Feb 2022 12:49:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:message-id:mime-version:subject:from:to:cc; bh=BSIelYmbPm1PuRZo7j2Bm2YpHBp5n2KMNsW2+koRF9o=; b=OmOAzde3hQuPTuUUuGTkKQgKqvdyaE/pxNZKEZAB5iLQVTOdo20BMzFWWZZl5ZbEuO sd1n997b8ys5m/fBIWHZk3R3yVqnEhs3ac+tNR/QL3TbIKDeDc62lEtuIZ+MTihDeNt+ /uMoEIQYhieWPpxjXMGJrySmFhr6E2Pz2jG4b9ZqxnGNp3uMfAKLGZPE310w3JihB6Ib OYleI1I1Od0cR5gz1VdeuTIKI4KRWWERhthYNiBNlzzfeN6M5islxffXtHWTDYPL/OBP oNw/HgJ2MVEPIIkZWMx+JbBuobi/Fc76/A58iX0Jry+a8W5t3vfGgWIhQw5UpJEYFWQ0 sjpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=BSIelYmbPm1PuRZo7j2Bm2YpHBp5n2KMNsW2+koRF9o=; b=hOfGx4JoKF3WVAxSuKBa6qcB9rwkOtJDPIXZBue0B/9ajs5j18Xd/NdMLMqgtfkMON AoeB4C5ySOSG5nVXnrxBxx6TIy79AhFe20sUcfnKgvQykwLwibE46wctmcHU8kcIgWrb 2P2YkSgbPRDBM8cxgclf7sGAft0vzvgqcoKSPK8xxrCZvy1QpPjnGq43c1Glrr1JQTp7 CNBSTy5MZPFmHkN3jrnxqOGVKfjCeP/l9MqfITS0Gw69u3Dl4xQwn28W3dHB7WY47BcV VDsmBLpX0qmX3lj+53sy3N1Y+yFDq/W2gH3+E7gfc6faf4h9STrP25yMzb9SslzDK3GJ 5LOg== X-Gm-Message-State: AOAM5307dEj1DHcK8KotiYnHcSy1ef9Cs/pAK1k9LpVQh28cUaIdeDi0 A4MP6Fb2Id55TYDhjW/fIPKE2dwGqY0XGldEhyM= X-Google-Smtp-Source: ABdhPJzP9ryL032NQtZ90yOl34xGEV9EIKEu/dsnCdcGdVufhTNhFh8paAmrE7BnYvSQ/nYsBzO5GcuJqvTablHmSFk= X-Received: from ndesaulniers1.mtv.corp.google.com ([2620:15c:211:202:dfad:458b:9fb2:b77a]) (user=ndesaulniers job=sendgmr) by 2002:a81:c501:: with SMTP id k1mr756814ywi.116.1644958191153; Tue, 15 Feb 2022 12:49:51 -0800 (PST) Date: Tue, 15 Feb 2022 12:49:47 -0800 Message-Id: <20220215204947.1719516-1-ndesaulniers@google.com> Mime-Version: 1.0 X-Developer-Key: i=ndesaulniers@google.com; a=ed25519; pk=lvO/pmg+aaCb6dPhyGC1GyOCvPueDrrc8Zeso5CaGKE= X-Developer-Signature: v=1; a=ed25519-sha256; t=1644958187; l=6237; s=20211004; h=from:subject; bh=KRPwLsTNNlHCWxCWXknX1SGak/+wjdb7pX5i8pARYhc=; b=MLcVqidAwW+ao1oHaVwGiibzFPdmdQSKX4iTNyUvI6u4uHIfv8BAO/pUH3DozcXFBD7mf8xaLcnQ OQKIrOg2BJTK0EvgDF4JpA04IH8tfxy/EXcxeGbLFrXi3Wg8qg0f X-Mailer: git-send-email 2.35.1.265.g69c8d7142f-goog Subject: [PATCH] Documentation/llvm: refresh docs for LLVM=1 From: Nick Desaulniers To: Masahiro Yamada , Jonathan Corbet , Andrew Morton Cc: Miguel Ojeda , Yujie Liu , Philip Li , julie.du@intel.com, Nick Desaulniers , Nathan Chancellor , Michal Marek , llvm@lists.linux.dev, linux-kbuild@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Refresh the docs for 2022: * add link to Chimera Linux. * add Quick Start section pointing out that LLVM=3D1 is the simple recommended method. * Re-order the sections on Clang and Cross Compiling to come after the section on LLVM utilities. I think the documentation flows better this way. * Add note about LLVM=3D1 to Omitting CROSS_COMPILE section. * Change note in Supported Architectures from discussing CC=3Dclang vs. LLVM=3D1 to discussion LLVM=3D1 vs. LLVM_IAS=3D0. * Update make command column of support architecture table; we now support LLVM=3D1 everywhere; just some more work to get ARCH=3Ds390 assembling with clang. * Word wrap a few columns over 80 lines. Signed-off-by: Nick Desaulniers --- Documentation/kbuild/llvm.rst | 82 +++++++++++++++++++++-------------- 1 file changed, 50 insertions(+), 32 deletions(-) diff --git a/Documentation/kbuild/llvm.rst b/Documentation/kbuild/llvm.rst index d32616891dcf..7f52cde70bc7 100644 --- a/Documentation/kbuild/llvm.rst +++ b/Documentation/kbuild/llvm.rst @@ -15,36 +15,27 @@ such as GCC and binutils. Ongoing work has allowed for = `Clang `_ and `LLVM `_ utilities to be used as viable substitutes. Distributions such as `Android `_, `ChromeOS -`_, and `OpenMandriva -`_ use Clang built kernels. `LLVM is a +`_, `OpenMandriva +`_, and `Chimera Linux +`_ use Clang built kernels. `LLVM is a collection of toolchain components implemented in terms of C++ objects `_. Clang is a front-end to LLVM th= at supports C and the GNU C extensions required by the kernel, and is pronoun= ced "klang," not "see-lang." =20 -Clang ------ +Quick Start +----------- +:: =20 -The compiler used can be swapped out via ``CC=3D`` command line argument t= o ``make``. -``CC=3D`` should be set when selecting a config and during a build. :: + make LLVM=3D1 =20 - make CC=3Dclang defconfig +for native builds or =20 - make CC=3Dclang +or :: =20 -Cross Compiling ---------------- + ARCH=3Darm64 make LLVM=3D1 =20 -A single Clang compiler binary will typically contain all supported backen= ds, -which can help simplify cross compiling. :: - - make ARCH=3Darm64 CC=3Dclang CROSS_COMPILE=3Daarch64-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=3D``. For -example: :: - - clang --target=3Daarch64-linux-gnu foo.c +for cross compiling. =20 LLVM Utilities -------------- @@ -63,6 +54,32 @@ They can be enabled individually. The full list of the p= arameters: :: The integrated assembler is enabled by default. You can pass ``LLVM_IAS=3D= 0`` to disable it. =20 +Clang +----- + +The compiler used can be swapped out via ``CC=3D`` command line argument to +``make``. ``CC=3D`` should be set when selecting a config and during a bu= ild. +``CC=3Dclang`` is implied by ``LLVM=3D1``, but if it's desired to simply u= se clang +as the compiler for the target, then ``CC=3D`` is a quick substitute. :: + + make CC=3Dclang defconfig + + make CC=3Dclang + +Cross Compiling +--------------- + +A single Clang compiler binary will typically contain all supported backen= ds, +which can help simplify cross compiling. :: + + make ARCH=3Darm64 CC=3Dclang CROSS_COMPILE=3Daarch64-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=3D``. +For example: :: + + clang --target=3Daarch64-linux-gnu foo.c + Omitting CROSS_COMPILE ---------------------- =20 @@ -71,7 +88,8 @@ As explained above, ``CROSS_COMPILE`` is used to set ``--= target=3D``. If ``CROSS_COMPILE`` is not specified, the ``--target=3D`` is infe= rred from ``ARCH``. =20 -That means if you use only LLVM tools, ``CROSS_COMPILE`` becomes unnecessa= ry. +That means if you use only LLVM tools via ``LLVM=3D1``, ``CROSS_COMPILE`` = becomes +unnecessary. =20 For example, to cross-compile the arm64 kernel:: =20 @@ -88,13 +106,13 @@ Supported Architectures LLVM does not target all of the architectures that Linux supports and just because a target is supported in LLVM does not mean that the kernel will build or work without any issues. Below is a general summary of -architectures that currently work with ``CC=3Dclang`` or ``LLVM=3D1``. Lev= el -of support corresponds to "S" values in the MAINTAINERS files. If an -architecture is not present, it either means that LLVM does not target -it or there are known issues. Using the latest stable version of LLVM or -even the development tree will generally yield the best results. -An architecture's ``defconfig`` is generally expected to work well, -certain configurations may have problems that have not been uncovered +architectures that currently work with ``LLVM=3D1`` but may need the integ= rated +assembler disabled via ``LLVM_IAS=3D0``. Level of support corresponds to "= S" +values in the MAINTAINERS files. If an architecture is not present, it eit= her +means that LLVM does not target it or there are known issues. Using the la= test +stable version of LLVM or even the development tree will generally yield t= he +best results. An architecture's ``defconfig`` is generally expected to wo= rk +well, certain configurations may have problems that have not been uncovered yet. Bug reports are always welcome at the issue tracker below! =20 .. list-table:: @@ -112,16 +130,16 @@ yet. Bug reports are always welcome at the issue trac= ker below! - ``LLVM=3D1`` * - mips - Maintained - - ``CC=3Dclang`` + - ``LLVM=3D1`` * - powerpc - Maintained - - ``CC=3Dclang`` + - ``LLVM=3D1`` * - riscv - Maintained - - ``CC=3Dclang`` + - ``LLVM=3D1`` * - s390 - Maintained - - ``CC=3Dclang`` + - ``LLVM=3D1 LLVM_IAS=3D0`` * - x86 - Supported - ``LLVM=3D1`` base-commit: c5d9ae265b105d9a67575fb67bd4650a6fc08e25 --=20 2.35.1.265.g69c8d7142f-goog