Skip to contentSkip to conversation

Documentation/llvm: add documentation on building w/ Clang/LLVM

PATCH Superseded Nick Desaulniers 7 participants 26 messages Feb 24, 2020 – Feb 27, 2020

Subsystems (3)
lore
Share & tools
lore

Nick Desaulniers

author reviewer
#0 lore raw

PATCH 1/1 Documentation/llvm: add documentation on building w/ Clang/LLVM

Added to kbuild documentation. Provides more official info on building kernels with Clang and LLVM than our wiki.

---
 Documentation/kbuild/index.rst |  1 +
 Documentation/kbuild/llvm.rst  | 80 ++++++++++++++++++++++++++++++++++
 2 files changed, 81 insertions(+)
 create mode 100644 Documentation/kbuild/llvm.rst
Documentation/kbuild/index.rst +1 -0
index 0f144fad99a6..3882bd5f7728 100644
@@ -19,6 +19,7 @@ Kernel Build System
 
     issues
     reproducible-builds
+    llvm
 
 .. only::  subproject and html
 
Documentation/kbuild/llvm.rst new file +80 -0

80 lines not on this page · raw message

Signature · 1 line
2.25.0.265.gbab2e86ba0-goog
reviewer
#1 lore raw
Quoted 32 lines · Nick Desaulniers

Added to kbuild documentation. Provides more official info on building kernels with Clang and LLVM than our wiki.

---
 Documentation/kbuild/index.rst |  1 +
 Documentation/kbuild/llvm.rst  | 80 ++++++++++++++++++++++++++++++++++
 2 files changed, 81 insertions(+)
 create mode 100644 Documentation/kbuild/llvm.rst
Documentation/kbuild/index.rst +1 -0
index 0f144fad99a6..3882bd5f7728 100644
@@ -19,6 +19,7 @@ Kernel Build System
 
     issues
     reproducible-builds
+    llvm
 
 .. only::  subproject and html
 
Documentation/kbuild/llvm.rst new file +2 -0
new file mode 100644
index 000000000000..68ae022aebc0
@@ -0,0 +1,80 @@
+==============================
+Building Linux with Clang/LLVM

Documentation/kbuild/llvm.rst line 12

Quoted 10 lines
Documentation/kbuild/llvm.rst new file +10 -0
+==============================
+
+This document covers how to build the Linux kernel with Clang and LLVM
+utilities.
+
+About
+-----
+
+The Linux kernel has always traditionally been compiled with GNU toolchains
+such as GCC and binutils. On going work has allowed for `Clang

Ongoing

Documentation/kbuild/llvm.rst line 21

Quoted 9 lines
Documentation/kbuild/llvm.rst new file +9 -0
+<https://clang.llvm.org/>`_ and `LLVM <https://llvm.org/>`_ utilities to be
+used as viable substitutes. Distributions such as `Android
+<https://www.android.com/>`_, `ChromeOS
+<https://www.chromium.org/chromium-os>`_, and `OpenMandriva
+<https://www.openmandriva.org/>`_ use Clang built kernels.  `LLVM is a
+collection of toolchain components implemented in terms of C++ objects
+<https://www.aosabook.org/en/llvm.html>`_. Clang is a front-end to LLVM that
+supports C and the GNU C extensions required by the kernel, and is pronounced
+"klang," not "see-lang."

Thanks for the info.

Signature · 1 line
~Randy
#2 lore raw
In reply to Nick Desaulniers
Quoted 8 lines · Nick Desaulniers

Added to kbuild documentation. Provides more official info on building kernels with Clang and LLVM than our wiki.

---

Perhaps, is it better to explicitly add it to MAINTAINERS?

MAINTAINERS +1 -0
@@ -4118,6 +4118,7 @@ W:        https://clangbuiltlinux.github.io/
 B:     https://github.com/ClangBuiltLinux/linux/issues
 C:     irc://chat.freenode.net/clangbuiltlinux
 S:     Supported
+F:     Documentation/kbuild/llvm.rst
 K:     \b(?i:clang|llvm)\b
 
 CLEANCACHE API

Thanks.

Signature · 2 lines
Best Regards
Masahiro Yamada
author reviewer
#3 lore raw
Quoted 18 lines · Masahiro Yamada
Quoted 8 lines · Nick Desaulniers

Added to kbuild documentation. Provides more official info on building kernels with Clang and LLVM than our wiki.

---

Perhaps, is it better to explicitly add it to MAINTAINERS?

MAINTAINERS W: https://clangbuiltlinux.github.io/ · line 4122

Quoted 5 lines
MAINTAINERS +1 -0
@@ -4118,6 +4118,7 @@ W:        https://clangbuiltlinux.github.io/
 B:     https://github.com/ClangBuiltLinux/linux/issues
 C:     irc://chat.freenode.net/clangbuiltlinux
 S:     Supported
+F:     Documentation/kbuild/llvm.rst
 K:     \b(?i:clang|llvm)\b

I'm happy to leave it to the maintainers of Documentation/. Otherwise we have a file for which there is no MAINTAINER, which seems ambiguous.

Signature · 2 lines
Thanks,
~Nick Desaulniers
#4 lore raw
Quoted 17 lines · Nick Desaulniers
Quoted 15 lines · Masahiro Yamada
Quoted 8 lines · Nick Desaulniers

Added to kbuild documentation. Provides more official info on building kernels with Clang and LLVM than our wiki.

---

Perhaps, is it better to explicitly add it to MAINTAINERS?

Quoted 12 lines

MAINTAINERS W: https://clangbuiltlinux.github.io/ · line 4122

Quoted 8 lines
MAINTAINERS +1 -0
@@ -4118,6 +4118,7 @@ W:        https://clangbuiltlinux.github.io/
 B:     https://github.com/ClangBuiltLinux/linux/issues
 C:     irc://chat.freenode.net/clangbuiltlinux
 S:     Supported
+F:     Documentation/kbuild/llvm.rst
 K:     \b(?i:clang|llvm)\b

I'm happy to leave it to the maintainers of Documentation/. Otherwise we have a file for which there is no MAINTAINER, which seems ambiguous.

It is common that MAINTAINERS lists per-file (per-driver) maintainers. It does not necessarily mean a person who picks up patches.

scripts/get_maintainer.pl lists maintainers that match any F:, N:, K: patterns.
So, both Doc and Kbuild maintainers/ML will still be listed.

Having said that, it is up to you. Either is fine with me. Another pattern 'K: \b(?i:clang|llvm)\b' covers this file anyway.

(BTW, I am also happy to see your name as the maintainer of this entry.)

Thanks.

--
Best Regards
Masahiro Yamada

#5 lore raw
Quoted 40 lines · Masahiro Yamada
Quoted 17 lines · Nick Desaulniers
Quoted 15 lines · Masahiro Yamada
Quoted 8 lines · Nick Desaulniers

Added to kbuild documentation. Provides more official info on building kernels with Clang and LLVM than our wiki.

---

Perhaps, is it better to explicitly add it to MAINTAINERS?

Quoted 12 lines

MAINTAINERS W: https://clangbuiltlinux.github.io/ · line 4122

Quoted 8 lines
MAINTAINERS +1 -0
@@ -4118,6 +4118,7 @@ W:        https://clangbuiltlinux.github.io/
 B:     https://github.com/ClangBuiltLinux/linux/issues
 C:     irc://chat.freenode.net/clangbuiltlinux
 S:     Supported
+F:     Documentation/kbuild/llvm.rst
 K:     \b(?i:clang|llvm)\b

I'm happy to leave it to the maintainers of Documentation/. Otherwise we have a file for which there is no MAINTAINER, which seems ambiguous.

It is common that MAINTAINERS lists per-file (per-driver) maintainers. It does not necessarily mean a person who picks up patches.

scripts/get_maintainer.pl lists maintainers that match any F:, N:, K: patterns.
So, both Doc and Kbuild maintainers/ML will still be listed.

Quoted 6 lines

Having said that, it is up to you. Either is fine with me. Another pattern 'K: \b(?i:clang|llvm)\b' covers this file anyway.

(BTW, I am also happy to see your name as the maintainer of this entry.)

+1 (Please drop the BTW - This was suggested in the brainstorming session on the ClangBuiltLinux Meetup in Zurich).

I suggest to add Nathan and Kees if they are willing to be responsible for the maintainer job.

- Sedat -

#6 lore raw
Quoted 48 lines · Sedat Dilek
Quoted 40 lines · Masahiro Yamada
Quoted 17 lines · Nick Desaulniers
Quoted 15 lines · Masahiro Yamada
Quoted 8 lines · Nick Desaulniers

Added to kbuild documentation. Provides more official info on building kernels with Clang and LLVM than our wiki.

---

Perhaps, is it better to explicitly add it to MAINTAINERS?

Quoted 12 lines

MAINTAINERS W: https://clangbuiltlinux.github.io/ · line 4122

Quoted 8 lines
MAINTAINERS +1 -0
@@ -4118,6 +4118,7 @@ W:        https://clangbuiltlinux.github.io/
 B:     https://github.com/ClangBuiltLinux/linux/issues
 C:     irc://chat.freenode.net/clangbuiltlinux
 S:     Supported
+F:     Documentation/kbuild/llvm.rst
 K:     \b(?i:clang|llvm)\b

I'm happy to leave it to the maintainers of Documentation/. Otherwise we have a file for which there is no MAINTAINER, which seems ambiguous.

It is common that MAINTAINERS lists per-file (per-driver) maintainers. It does not necessarily mean a person who picks up patches.

scripts/get_maintainer.pl lists maintainers that match any F:, N:, K: patterns.
So, both Doc and Kbuild maintainers/ML will still be listed.

Quoted 6 lines

Having said that, it is up to you. Either is fine with me. Another pattern 'K: \b(?i:clang|llvm)\b' covers this file anyway.

(BTW, I am also happy to see your name as the maintainer of this entry.)

Quoted 7 lines

+1 (Please drop the BTW - This was suggested in the brainstorming session on the ClangBuiltLinux Meetup in Zurich).

I suggest to add Nathan and Kees if they are willing to be responsible for the maintainer job.

- Sedat -

I would not mind having my name added under this MAINTAINERS entry but I definitely think that is a conversation for a different thread.

Cheers,
Nathan

Reviewed-by on v1 1/1
#7 lore raw
In reply to Nick Desaulniers
Quoted 61 lines · Nick Desaulniers

Added to kbuild documentation. Provides more official info on building kernels with Clang and LLVM than our wiki.

---
 Documentation/kbuild/index.rst |  1 +
 Documentation/kbuild/llvm.rst  | 80 ++++++++++++++++++++++++++++++++++
 2 files changed, 81 insertions(+)
 create mode 100644 Documentation/kbuild/llvm.rst
Documentation/kbuild/index.rst +1 -0
index 0f144fad99a6..3882bd5f7728 100644
@@ -19,6 +19,7 @@ Kernel Build System
 
     issues
     reproducible-builds
+    llvm
 
 .. only::  subproject and html
 
Documentation/kbuild/llvm.rst new file +31 -0
new file mode 100644
index 000000000000..68ae022aebc0
@@ -0,0 +1,80 @@
+==============================
+Building Linux with Clang/LLVM
+==============================
+
+This document covers how to build the Linux kernel with Clang and LLVM
+utilities.
+
+About
+-----
+
+The Linux kernel has always traditionally been compiled with GNU toolchains
+such as GCC and binutils. On going work has allowed for `Clang
+<https://clang.llvm.org/>`_ and `LLVM <https://llvm.org/>`_ utilities to be
+used as viable substitutes. Distributions such as `Android
+<https://www.android.com/>`_, `ChromeOS
+<https://www.chromium.org/chromium-os>`_, and `OpenMandriva
+<https://www.openmandriva.org/>`_ use Clang built kernels.  `LLVM is a
+collection of toolchain components implemented in terms of C++ objects
+<https://www.aosabook.org/en/llvm.html>`_. Clang is a front-end to LLVM that
+supports C and the GNU C extensions required by the kernel, and is pronounced
+"klang," not "see-lang."
+
+Clang
+-----
+
+The compiler used can be swapped out via `CC=` command line argument to `make`.
+`CC=` should be set when selecting a config and during a build.
+
+	make CC=clang defconfig
+
+	make CC=clang

Documentation/kbuild/llvm.rst line 41

Quoted 10 lines
Documentation/kbuild/llvm.rst new file +10 -0
+
+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
+
+`CROSS_COMPILE` is not used to suffix the Clang compiler binary, instead

s/suffix/prefix/

Quoted 29 lines
Documentation/kbuild/llvm.rst new file +29 -0
+`CROSS_COMPILE` is used to set a command line flag: `--target <triple>`. For
+example:
+
+	clang --target aarch64-linux-gnu foo.c
+
+LLVM Utilities
+--------------
+
+LLVM has substitutes for GNU binutils utilities. These can be invoked as
+additional parameters to `make`.
+
+	make CC=clang AS=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip \\
+	  OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump OBJSIZE=llvm-objsize \\
+	  READELF=llvm-readelf HOSTCC=clang HOSTCXX=clang++ HOSTAR=llvm-ar \\
+	  HOSTLD=ld.lld
+
+Getting Help
+------------
+
+- `Website <https://clangbuiltlinux.github.io/>`_
+- `Mailing List <https://groups.google.com/forum/#!forum/clang-built-linux>`_: <[email protected]>
+- `Issue Tracker <https://github.com/ClangBuiltLinux/linux/issues>`_
+- IRC: #clangbuiltlinux on chat.freenode.net
+- `Telegram <https://t.me/ClangBuiltLinux>`_: @ClangBuiltLinux
+- `Wiki <https://github.com/ClangBuiltLinux/linux/wiki>`_
+- `Beginner Bugs <https://github.com/ClangBuiltLinux/linux/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22>`_
+
+Getting LLVM
+-------------

Documentation/kbuild/llvm.rst line 80

Quoted 10 lines
Documentation/kbuild/llvm.rst new file +10 -0
+
+- http://releases.llvm.org/download.html
+- https://github.com/llvm/llvm-project
+- https://llvm.org/docs/GettingStarted.html
+- https://llvm.org/docs/CMake.html
+- https://apt.llvm.org/
+- https://www.archlinux.org/packages/extra/x86_64/llvm/
+- https://github.com/ClangBuiltLinux/tc-build
+- https://github.com/ClangBuiltLinux/linux/wiki/Building-Clang-from-source
+- https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/

Should this also include an update to Documentation/process/changes.rst with the minimum version required? (I would expect this to be "9" for Clang, and "11" for ld.lld.)

Otherwise, yes, with Randy and Masahiro's suggestions, please consider it:

Signature · 1 line
Kees Cook
#8 lore raw
Quoted 110 lines · Kees Cook
Quoted 61 lines · Nick Desaulniers

Added to kbuild documentation. Provides more official info on building kernels with Clang and LLVM than our wiki.

---
 Documentation/kbuild/index.rst |  1 +
 Documentation/kbuild/llvm.rst  | 80 ++++++++++++++++++++++++++++++++++
 2 files changed, 81 insertions(+)
 create mode 100644 Documentation/kbuild/llvm.rst
Documentation/kbuild/index.rst +1 -0
index 0f144fad99a6..3882bd5f7728 100644
@@ -19,6 +19,7 @@ Kernel Build System
 
     issues
     reproducible-builds
+    llvm
 
 .. only::  subproject and html
 
Documentation/kbuild/llvm.rst new file +31 -0
new file mode 100644
index 000000000000..68ae022aebc0
@@ -0,0 +1,80 @@
+==============================
+Building Linux with Clang/LLVM
+==============================
+
+This document covers how to build the Linux kernel with Clang and LLVM
+utilities.
+
+About
+-----
+
+The Linux kernel has always traditionally been compiled with GNU toolchains
+such as GCC and binutils. On going work has allowed for `Clang
+<https://clang.llvm.org/>`_ and `LLVM <https://llvm.org/>`_ utilities to be
+used as viable substitutes. Distributions such as `Android
+<https://www.android.com/>`_, `ChromeOS
+<https://www.chromium.org/chromium-os>`_, and `OpenMandriva
+<https://www.openmandriva.org/>`_ use Clang built kernels.  `LLVM is a
+collection of toolchain components implemented in terms of C++ objects
+<https://www.aosabook.org/en/llvm.html>`_. Clang is a front-end to LLVM that
+supports C and the GNU C extensions required by the kernel, and is pronounced
+"klang," not "see-lang."
+
+Clang
+-----
+
+The compiler used can be swapped out via `CC=` command line argument to `make`.
+`CC=` should be set when selecting a config and during a build.
+
+	make CC=clang defconfig
+
+	make CC=clang

Documentation/kbuild/llvm.rst line 41

Quoted 10 lines
Documentation/kbuild/llvm.rst new file +10 -0
+
+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
+
+`CROSS_COMPILE` is not used to suffix the Clang compiler binary, instead

s/suffix/prefix/

Quoted 35 lines
Documentation/kbuild/llvm.rst new file +35 -0
+`CROSS_COMPILE` is used to set a command line flag: `--target <triple>`. For
+example:
+
+	clang --target aarch64-linux-gnu foo.c
+
+LLVM Utilities
+--------------
+
+LLVM has substitutes for GNU binutils utilities. These can be invoked as
+additional parameters to `make`.
+
+	make CC=clang AS=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip \\
+	  OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump OBJSIZE=llvm-objsize \\
+	  READELF=llvm-readelf HOSTCC=clang HOSTCXX=clang++ HOSTAR=llvm-ar \\
+	  HOSTLD=ld.lld
+
+Getting Help
+------------
+
+- `Website <https://clangbuiltlinux.github.io/>`_
+- `Mailing List <https://groups.google.com/forum/#!forum/clang-built-linux>`_: <[email protected]>
+- `Issue Tracker <https://github.com/ClangBuiltLinux/linux/issues>`_
+- IRC: #clangbuiltlinux on chat.freenode.net
+- `Telegram <https://t.me/ClangBuiltLinux>`_: @ClangBuiltLinux
+- `Wiki <https://github.com/ClangBuiltLinux/linux/wiki>`_
+- `Beginner Bugs <https://github.com/ClangBuiltLinux/linux/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22>`_
+
+Getting LLVM
+-------------
+
+- http://releases.llvm.org/download.html
+- https://github.com/llvm/llvm-project
+- https://llvm.org/docs/GettingStarted.html
+- https://llvm.org/docs/CMake.html
+- https://apt.llvm.org/
Quoted 8 lines

Documentation/kbuild/llvm.rst line 80

Quoted 4 lines
Documentation/kbuild/llvm.rst new file +4 -0
+- https://www.archlinux.org/packages/extra/x86_64/llvm/
+- https://github.com/ClangBuiltLinux/tc-build
+- https://github.com/ClangBuiltLinux/linux/wiki/Building-Clang-from-source
+- https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/

Should this also include an update to Documentation/process/changes.rst with the minimum version required? (I would expect this to be "9" for Clang, and "11" for ld.lld.)

I think the clang one should be added in a separate patch that solidifies that in include/linux/compiler-clang.h with a CLANG_VERSION macro and version check, like in include/linux/compiler-gcc.h.

ld.lld's minimum version should also be 9, what is the blocking issue that makes it 11?

Quoted 6 lines

Otherwise, yes, with Randy and Masahiro's suggestions, please consider it:

Signature · 1 line
Kees Cook

Cheers,
Nathan

#9 lore raw
Quoted 3 lines · Nathan Chancellor

I think the clang one should be added in a separate patch that solidifies that in include/linux/compiler-clang.h with a CLANG_VERSION macro and version check, like in include/linux/compiler-gcc.h.

Sounds good.

Quoted 2 lines

ld.lld's minimum version should also be 9, what is the blocking issue that makes it 11?

I think I've mostly got future patches on my mind. lld before 11 will blow up on this:
https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git/log/?h=build/link-time
(but I haven't sent this patch yet since I didn't want to break lld until it was fixed, which it is now, but I got distracted by other stuff).

Additionally there will be LTO, but LTO will be version-checked. Then I was thinking about the orphan section handling, and there is very clearly more work to be done there too... (i.e. the synthesized sections get reported by the orphan warning before they're actually processed by DISCARD is some cases -- I still need to isolate the behavior and open a bug.)

Signature · 1 line
Kees Cook
author reviewer
#10 lore raw
In reply to Nathan Chancellor
Quoted 10 lines · Nathan Chancellor
Quoted 3 lines

Should this also include an update to Documentation/process/changes.rst with the minimum version required? (I would expect this to be "9" for Clang, and "11" for ld.lld.)

I think the clang one should be added in a separate patch that solidifies that in include/linux/compiler-clang.h with a CLANG_VERSION macro and version check, like in include/linux/compiler-gcc.h.

ld.lld's minimum version should also be 9, what is the blocking issue that makes it 11?

I'm super hesitant to put a minimally required version of Clang, since it really depends on the configs you're using. Sure, clang-9 will probably work better than clang-4 for some configs, but I would say ToT clang built from source would be even better, as unrealistic as that is for most people. The question of "what's our support model" hasn't realistically come up yet, so I don't really want to make a decision on that right now and potentially pigeonhole us into some support scheme that's theoretical or hypothetical. We need to expand out the CI more, and get more people to even care about Clang, before we start to concern ourselves with providing an answer to the question "what versions of clang are supported?" But it's just a strong opinion of mine, held loosely.

Either way, it can be done (or not) in a follow up patch. I would like to land some Documentation/ even if it's not perfect, we can go from there.

Signature · 2 lines
Thanks,
~Nick Desaulniers
#11 lore raw
Quoted 10 lines · Nick Desaulniers
Quoted 8 lines · Nathan Chancellor
Quoted 3 lines

Should this also include an update to Documentation/process/changes.rst with the minimum version required? (I would expect this to be "9" for Clang, and "11" for ld.lld.)

I think the clang one should be added in a separate patch that solidifies that in include/linux/compiler-clang.h with a CLANG_VERSION macro and version check, like in include/linux/compiler-gcc.h.

Quoted 6 lines
Quoted 2 lines

ld.lld's minimum version should also be 9, what is the blocking issue that makes it 11?

I'm super hesitant to put a minimally required version of Clang, since it really depends on the configs you're using. Sure, clang-9 will probably work better than clang-4 for some configs, but I would say

I think it's not unreasonable to say clang-9 due to x86 not building prior to clang-9. (Yes, other archs can build with earlier clang, but that's true for earlier gccs too.)

Quoted 9 lines

ToT clang built from source would be even better, as unrealistic as that is for most people. The question of "what's our support model" hasn't realistically come up yet, so I don't really want to make a decision on that right now and potentially pigeonhole us into some support scheme that's theoretical or hypothetical. We need to expand out the CI more, and get more people to even care about Clang, before we start to concern ourselves with providing an answer to the question "what versions of clang are supported?" But it's just a strong opinion of mine, held loosely.

"Supported" is hand-wavey anyway. I would say, "this version is _expected_ to build the kernel", etc.

Quoted 3 lines

Either way, it can be done (or not) in a follow up patch. I would like to land some Documentation/ even if it's not perfect, we can go from there.

Sounds fine, but I think we should take a specific version stand as the "minimum" version. Being able to build x86 defconfig is a good minimum IMO.

Signature · 1 line
Kees Cook
#12 lore raw
Quoted 3 lines · Kees Cook

I think we should take a specific version stand as the "minimum" version. Being able to build x86 defconfig is a good minimum IMO.

Agree.

It's odd to say that clang 4 is fine for arm when it's not fine for x86. It's also reasonable to expect arm users to upgrade their compiler to a more recent version when the only cost is a very small bit of time.

author reviewer
#13 lore raw
Quoted 6 lines · Joe Perches
Quoted 3 lines · Kees Cook

I think we should take a specific version stand as the "minimum" version. Being able to build x86 defconfig is a good minimum IMO.

Quoted 6 lines

Agree.

It's odd to say that clang 4 is fine for arm when it's not fine for x86. It's also reasonable to expect arm users to upgrade their compiler to a more recent version when the only cost is a very small bit of time.

That's a very x86 centric point of view.

Signature · 2 lines
Thanks,
~Nick Desaulniers
#14 lore raw
Quoted 6 lines · Nick Desaulniers
Quoted 5 lines · Joe Perches
Quoted 3 lines · Kees Cook

I think we should take a specific version stand as the "minimum" version. Being able to build x86 defconfig is a good minimum IMO.

Quoted 8 lines
Quoted 6 lines

Agree.

It's odd to say that clang 4 is fine for arm when it's not fine for x86. It's also reasonable to expect arm users to upgrade their compiler to a more recent version when the only cost is a very small bit of time.

That's a very x86 centric point of view.

Really?

How many code generation improvements and possible defects have been corrected between clang 4 and clang 10 for arm?

I presume more than a few.

#15 lore raw
In reply to Nick Desaulniers
Quoted 26 lines · Nick Desaulniers
Quoted 10 lines · Nathan Chancellor
Quoted 3 lines

Should this also include an update to Documentation/process/changes.rst with the minimum version required? (I would expect this to be "9" for Clang, and "11" for ld.lld.)

I think the clang one should be added in a separate patch that solidifies that in include/linux/compiler-clang.h with a CLANG_VERSION macro and version check, like in include/linux/compiler-gcc.h.

ld.lld's minimum version should also be 9, what is the blocking issue that makes it 11?

I'm super hesitant to put a minimally required version of Clang, since it really depends on the configs you're using. Sure, clang-9 will probably work better than clang-4 for some configs, but I would say ToT clang built from source would be even better, as unrealistic as that is for most people. The question of "what's our support model" hasn't realistically come up yet, so I don't really want to make a decision on that right now and potentially pigeonhole us into some support scheme that's theoretical or hypothetical. We need to expand out the CI more, and get more people to even care about Clang, before we start to concern ourselves with providing an answer to the question "what versions of clang are supported?" But it's just a strong opinion of mine, held loosely.

Quoted 6 lines

Either way, it can be done (or not) in a follow up patch. I would like to land some Documentation/ even if it's not perfect, we can go from there.

Signature · 2 lines
Thanks,
~Nick Desaulniers

I think the question of support model is something that we are going to have to sit down and figure out sooner rather than later, especially if we are adding this file to the Documentation; we are saying that this IS supported in some fashion, we need to be able to answer how we are going to resolve issues and what versions can be adequately expect to work with the kernel.

I think that being able to tell people to update is not unreasonable, given how efficient we are getting fixing into clang. However, clang's release model is definitely different from gcc's and that can make getting fixes into the hands of regular users harder, aside from asking them to build their own version, which again, is not that difficult and hard to do with something like tc-build.

I agree this should happen in a follow up patch. I think starting with clang-9 and saying if anything older works, cool, otherwise update is probably a decent initial model.

Cheers,
Nathan

Reviewed-by
#16 lore raw
In reply to Kees Cook
Quoted 120 lines · Kees Cook
Quoted 61 lines · Nick Desaulniers

Added to kbuild documentation. Provides more official info on building kernels with Clang and LLVM than our wiki.

---
 Documentation/kbuild/index.rst |  1 +
 Documentation/kbuild/llvm.rst  | 80 ++++++++++++++++++++++++++++++++++
 2 files changed, 81 insertions(+)
 create mode 100644 Documentation/kbuild/llvm.rst
Documentation/kbuild/index.rst +1 -0
index 0f144fad99a6..3882bd5f7728 100644
@@ -19,6 +19,7 @@ Kernel Build System
 
     issues
     reproducible-builds
+    llvm
 
 .. only::  subproject and html
 
Documentation/kbuild/llvm.rst new file +31 -0
new file mode 100644
index 000000000000..68ae022aebc0
@@ -0,0 +1,80 @@
+==============================
+Building Linux with Clang/LLVM
+==============================
+
+This document covers how to build the Linux kernel with Clang and LLVM
+utilities.
+
+About
+-----
+
+The Linux kernel has always traditionally been compiled with GNU toolchains
+such as GCC and binutils. On going work has allowed for `Clang
+<https://clang.llvm.org/>`_ and `LLVM <https://llvm.org/>`_ utilities to be
+used as viable substitutes. Distributions such as `Android
+<https://www.android.com/>`_, `ChromeOS
+<https://www.chromium.org/chromium-os>`_, and `OpenMandriva
+<https://www.openmandriva.org/>`_ use Clang built kernels.  `LLVM is a
+collection of toolchain components implemented in terms of C++ objects
+<https://www.aosabook.org/en/llvm.html>`_. Clang is a front-end to LLVM that
+supports C and the GNU C extensions required by the kernel, and is pronounced
+"klang," not "see-lang."
+
+Clang
+-----
+
+The compiler used can be swapped out via `CC=` command line argument to `make`.
+`CC=` should be set when selecting a config and during a build.
+
+     make CC=clang defconfig
+
+     make CC=clang

Documentation/kbuild/llvm.rst line 41

Quoted 10 lines
Documentation/kbuild/llvm.rst new file +10 -0
+
+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
+
+`CROSS_COMPILE` is not used to suffix the Clang compiler binary, instead

s/suffix/prefix/

Quoted 29 lines
Documentation/kbuild/llvm.rst new file +29 -0
+`CROSS_COMPILE` is used to set a command line flag: `--target <triple>`. For
+example:
+
+     clang --target aarch64-linux-gnu foo.c
+
+LLVM Utilities
+--------------
+
+LLVM has substitutes for GNU binutils utilities. These can be invoked as
+additional parameters to `make`.
+
+     make CC=clang AS=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip \\
+       OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump OBJSIZE=llvm-objsize \\
+       READELF=llvm-readelf HOSTCC=clang HOSTCXX=clang++ HOSTAR=llvm-ar \\
+       HOSTLD=ld.lld
+
+Getting Help
+------------
+
+- `Website <https://clangbuiltlinux.github.io/>`_
+- `Mailing List <https://groups.google.com/forum/#!forum/clang-built-linux>`_: <[email protected]>
+- `Issue Tracker <https://github.com/ClangBuiltLinux/linux/issues>`_
+- IRC: #clangbuiltlinux on chat.freenode.net
+- `Telegram <https://t.me/ClangBuiltLinux>`_: @ClangBuiltLinux
+- `Wiki <https://github.com/ClangBuiltLinux/linux/wiki>`_
+- `Beginner Bugs <https://github.com/ClangBuiltLinux/linux/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22>`_
+
+Getting LLVM
+-------------

Documentation/kbuild/llvm.rst line 80

Quoted 10 lines
Documentation/kbuild/llvm.rst new file +10 -0
+
+- http://releases.llvm.org/download.html
+- https://github.com/llvm/llvm-project
+- https://llvm.org/docs/GettingStarted.html
+- https://llvm.org/docs/CMake.html
+- https://apt.llvm.org/
+- https://www.archlinux.org/packages/extra/x86_64/llvm/
+- https://github.com/ClangBuiltLinux/tc-build
+- https://github.com/ClangBuiltLinux/linux/wiki/Building-Clang-from-source
+- https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/

Should this also include an update to Documentation/process/changes.rst with the minimum version required? (I would expect this to be "9" for Clang, and "11" for ld.lld.)

Quoted 4 lines

Otherwise, yes, with Randy and Masahiro's suggestions, please consider it:

Hi,

that update for documentation purposes was overdue.

My last experiments were with Linux v5.3 and llvm-toolchain 9.0 means Clang compiler v9.0 and LLD linker v9.0 on x86-64.
With Debian's kernel-config I was able to build OOTB (out-of-the-box) with no extra patches.
I cannot speak for higher Linux and/or llvm-toolchain versions/combinations.

I would prefer such an information also for the *supported* Linux versions, so people have a good orientation.

So for the above scenario, you can add:

Linux v5.3, x86-64)

Regards,
- Sedat -

Quoted 7 lines

--
Kees Cook

--
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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/202002242003.870E5F80%40keescook.

author reviewer
#17 lore raw

PATCH v2 1/1 Documentation/llvm: add documentation on building w/ Clang/LLVM

In reply to Nick Desaulniers

Added to kbuild documentation. Provides more official info on building kernels with Clang and LLVM than our wiki.

---
Changes V1 -> V2:
* s/On going/ongoing/
* add Randy's Suggested-by
* add Nathan and Sedat's Reviewed-by
* Upgrade Kees' Sugguested-by to Reviewed-by
* s/suffix/prefix/

 Documentation/kbuild/index.rst |  1 +
 Documentation/kbuild/llvm.rst  | 80 ++++++++++++++++++++++++++++++++++
 2 files changed, 81 insertions(+)
 create mode 100644 Documentation/kbuild/llvm.rst
Documentation/kbuild/index.rst +1 -0
index 0f144fad99a6..3882bd5f7728 100644
@@ -19,6 +19,7 @@ Kernel Build System
 
     issues
     reproducible-builds
+    llvm
 
 .. only::  subproject and html
 
Documentation/kbuild/llvm.rst new file +80 -0

80 lines not on this page · raw message

Signature · 1 line
2.25.0.265.gbab2e86ba0-goog
Reviewed-by Kees Cook on v2 1/1
#18 lore raw

Hi.

Quoted 9 lines · Nick Desaulniers

Added to kbuild documentation. Provides more official info on building kernels with Clang and LLVM than our wiki.

Quoted 4 lines

---
Changes V1 -> V2:
* s/On going/ongoing/
* add Randy's Suggested-by

I do not understand this tag update.

As far as I saw the review process,
I do not think Randy deserves to have Suggested-by because he just pointed out a typo (on going -> ongoing) :
https://patchwork.kernel.org/patch/11401189/#23179575

(or, was there off-line activity I had missed?)

Quoted 2 lines

* add Nathan and Sedat's Reviewed-by
* Upgrade Kees' Sugguested-by to Reviewed-by

We can add both

and

I think Suggested-by and Reviewed-by should be orthogonal.

Thanks.

Quoted 107 lines

* s/suffix/prefix/

 Documentation/kbuild/index.rst |  1 +
 Documentation/kbuild/llvm.rst  | 80 ++++++++++++++++++++++++++++++++++
 2 files changed, 81 insertions(+)
 create mode 100644 Documentation/kbuild/llvm.rst
Documentation/kbuild/index.rst +1 -0
index 0f144fad99a6..3882bd5f7728 100644
@@ -19,6 +19,7 @@ Kernel Build System
 
     issues
     reproducible-builds
+    llvm
 
 .. only::  subproject and html
 
Documentation/kbuild/llvm.rst new file +80 -1
new file mode 100644
index 000000000000..d6c79eb4e23e
@@ -0,0 +1,80 @@
+==============================
+Building Linux with Clang/LLVM
+==============================
+
+This document covers how to build the Linux kernel with Clang and LLVM
+utilities.
+
+About
+-----
+
+The Linux kernel has always traditionally been compiled with GNU toolchains
+such as GCC and binutils. Ongoing work has allowed for `Clang
+<https://clang.llvm.org/>`_ and `LLVM <https://llvm.org/>`_ utilities to be
+used as viable substitutes. Distributions such as `Android
+<https://www.android.com/>`_, `ChromeOS
+<https://www.chromium.org/chromium-os>`_, and `OpenMandriva
+<https://www.openmandriva.org/>`_ use Clang built kernels.  `LLVM is a
+collection of toolchain components implemented in terms of C++ objects
+<https://www.aosabook.org/en/llvm.html>`_. Clang is a front-end to LLVM that
+supports C and the GNU C extensions required by the kernel, and is pronounced
+"klang," not "see-lang."
+
+Clang
+-----
+
+The compiler used can be swapped out via `CC=` command line argument to `make`.
+`CC=` should be set when selecting a config and during a build.
+
+       make CC=clang defconfig
+
+       make CC=clang
+
+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
+
+`CROSS_COMPILE` is not used to prefix the Clang compiler binary, instead
+`CROSS_COMPILE` is used to set a command line flag: `--target <triple>`. For
+example:
+
+       clang --target aarch64-linux-gnu foo.c
+
+LLVM Utilities
+--------------
+
+LLVM has substitutes for GNU binutils utilities. These can be invoked as
+additional parameters to `make`.
+
+       make CC=clang AS=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip \\
+         OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump OBJSIZE=llvm-objsize \\
+         READELF=llvm-readelf HOSTCC=clang HOSTCXX=clang++ HOSTAR=llvm-ar \\
+         HOSTLD=ld.lld
+
+Getting Help
+------------
+
+- `Website <https://clangbuiltlinux.github.io/>`_
+- `Mailing List <https://groups.google.com/forum/#!forum/clang-built-linux>`_: <[email protected]>
+- `Issue Tracker <https://github.com/ClangBuiltLinux/linux/issues>`_
+- IRC: #clangbuiltlinux on chat.freenode.net
+- `Telegram <https://t.me/ClangBuiltLinux>`_: @ClangBuiltLinux
+- `Wiki <https://github.com/ClangBuiltLinux/linux/wiki>`_
+- `Beginner Bugs <https://github.com/ClangBuiltLinux/linux/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22>`_
+
+Getting LLVM
+-------------
+
+- http://releases.llvm.org/download.html
+- https://github.com/llvm/llvm-project
+- https://llvm.org/docs/GettingStarted.html
+- https://llvm.org/docs/CMake.html
+- https://apt.llvm.org/
+- https://www.archlinux.org/packages/extra/x86_64/llvm/
+- https://github.com/ClangBuiltLinux/tc-build
+- https://github.com/ClangBuiltLinux/linux/wiki/Building-Clang-from-source
+- https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/
--
Quoted 2 lines

2.25.0.265.gbab2e86ba0-goog

--
Best Regards
Masahiro Yamada

#19 lore raw
Quoted 21 lines · Masahiro Yamada

Hi.

Quoted 9 lines · Nick Desaulniers

Added to kbuild documentation. Provides more official info on building kernels with Clang and LLVM than our wiki.

Quoted 4 lines

---
Changes V1 -> V2:
* s/On going/ongoing/
* add Randy's Suggested-by

Quoted 9 lines

I do not understand this tag update.

As far as I saw the review process,
I do not think Randy deserves to have Suggested-by because he just pointed out a typo (on going -> ongoing) :
https://patchwork.kernel.org/patch/11401189/#23179575

(or, was there off-line activity I had missed?)

Hi Masahiro,

I got some credits from Nick for a review by seeing a typo - not on a review of the code - and H. Peter Anvin asked why.

I am not sure what is here the correct credit to give. Depends a "Reviewed-by" and/or "Suggested-by" on a technical review?

My POV: When people take time to look over patches they should get credits - sort of esteem.

Regards,
- Sedat -

P.S.: Tipp: Use codespell to find typos :-).

[1] https://git.kernel.org/linus/0e2e160033283e20f688d8bad5b89460cc5bfcc4
"x86/asm: Add _ASM_ARG* constants for argument registers to <asm/asm.h>"

#20 lore raw
Quoted 33 lines · Sedat Dilek
Quoted 21 lines · Masahiro Yamada

Hi.

Quoted 9 lines · Nick Desaulniers

Added to kbuild documentation. Provides more official info on building kernels with Clang and LLVM than our wiki.

Quoted 4 lines

---
Changes V1 -> V2:
* s/On going/ongoing/
* add Randy's Suggested-by

Quoted 9 lines

I do not understand this tag update.

As far as I saw the review process,
I do not think Randy deserves to have Suggested-by because he just pointed out a typo (on going -> ongoing) :
https://patchwork.kernel.org/patch/11401189/#23179575

(or, was there off-line activity I had missed?)

Quoted 7 lines

Hi Masahiro,

I got some credits from Nick for a review by seeing a typo - not on a review of the code - and H. Peter Anvin asked why.

I am not sure what is here the correct credit to give. Depends a "Reviewed-by" and/or "Suggested-by" on a technical review?

Documentation/process/submitting-patches.rst

13) Using Reported-by:, Tested-by:, Reviewed-by:, Suggested-by: and Fixes:

is a helpful guideline.

Signature · 2 lines
Best Regards
Masahiro Yamada
#21 lore raw
Quoted 45 lines · Masahiro Yamada
Quoted 33 lines · Sedat Dilek
Quoted 21 lines · Masahiro Yamada

Hi.

Quoted 9 lines · Nick Desaulniers

Added to kbuild documentation. Provides more official info on building kernels with Clang and LLVM than our wiki.

Quoted 4 lines

---
Changes V1 -> V2:
* s/On going/ongoing/
* add Randy's Suggested-by

Quoted 9 lines

I do not understand this tag update.

As far as I saw the review process,
I do not think Randy deserves to have Suggested-by because he just pointed out a typo (on going -> ongoing) :
https://patchwork.kernel.org/patch/11401189/#23179575

(or, was there off-line activity I had missed?)

Quoted 7 lines

Hi Masahiro,

I got some credits from Nick for a review by seeing a typo - not on a review of the code - and H. Peter Anvin asked why.

I am not sure what is here the correct credit to give. Depends a "Reviewed-by" and/or "Suggested-by" on a technical review?

Quoted 6 lines

Documentation/process/submitting-patches.rst

13) Using Reported-by:, Tested-by:, Reviewed-by:, Suggested-by: and Fixes:

is a helpful guideline.

Thanks for CCing Randy and the pointer to "Documentation/process/submitting-patches.rst" file.

This document [1] is mostly focusing on technical handling.

- Sedat -

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst#n584

reviewer
#22 lore raw
In reply to Masahiro Yamada
Quoted 20 lines · Masahiro Yamada

Hi.

Quoted 9 lines · Nick Desaulniers

Added to kbuild documentation. Provides more official info on building kernels with Clang and LLVM than our wiki.

Quoted 4 lines

---
Changes V1 -> V2:
* s/On going/ongoing/
* add Randy's Suggested-by

Quoted 5 lines

I do not understand this tag update.

As far as I saw the review process,
I do not think Randy deserves to have Suggested-by because he just pointed out a typo (on going -> ongoing) :

I agree.

Quoted 3 lines

https://patchwork.kernel.org/patch/11401189/#23179575

(or, was there off-line activity I had missed?)

Signature · 1 line
~Randy
author reviewer
#23 lore raw

PATCH v3 1/1 Documentation/llvm: add documentation on building w/ Clang/LLVM

In reply to Nick Desaulniers

Added to kbuild documentation. Provides more official info on building kernels with Clang and LLVM than our wiki.

---
Changes V2 -> V3:
* Drop Randy's Suggested-by tag. Sorry Randy, I do appreciate the review though.
* Add F: line to MAINTAINERS.

Changes V1 -> V2:
* s/On going/ongoing/
* add Randy's Suggested-by
* add Nathan and Sedat's Reviewed-by
* Upgrade Kees' Sugguested-by to Reviewed-by
* s/suffix/prefix/

 Documentation/kbuild/index.rst |  1 +
 Documentation/kbuild/llvm.rst  | 80 ++++++++++++++++++++++++++++++++++
 MAINTAINERS                    |  1 +
 3 files changed, 82 insertions(+)
 create mode 100644 Documentation/kbuild/llvm.rst
Documentation/kbuild/index.rst +1 -0
index 0f144fad99a6..3882bd5f7728 100644
@@ -19,6 +19,7 @@ Kernel Build System
 
     issues
     reproducible-builds
+    llvm
 
 .. only::  subproject and html
 
Documentation/kbuild/llvm.rst new file +80 -0

80 lines not on this page · raw message

MAINTAINERS +1 -0
index 8b85f22b9b69..79e1f9bfb2b6 100644
@@ -4124,6 +4124,7 @@ B:	https://github.com/ClangBuiltLinux/linux/issues
 C:	irc://chat.freenode.net/clangbuiltlinux
 S:	Supported
 K:	\b(?i:clang|llvm)\b
+F:	Documentation/kbuild/llvm.rst
 
 CLEANCACHE API
 M:	Konrad Rzeszutek Wilk <[email protected]>
Signature · 1 line
2.25.0.265.gbab2e86ba0-goog
#24 lore raw
Quoted 15 lines · Nick Desaulniers

Added to kbuild documentation. Provides more official info on building kernels with Clang and LLVM than our wiki.

---
Changes V2 -> V3:
* Drop Randy's Suggested-by tag. Sorry Randy, I do appreciate the review though.
* Add F: line to MAINTAINERS.

Quoted 6 lines

Changes V1 -> V2:
* s/On going/ongoing/
* add Randy's Suggested-by
* add Nathan and Sedat's Reviewed-by
* Upgrade Kees' Sugguested-by to Reviewed-by
* s/suffix/prefix/

Setting aside the minimal version discussion,
I am fine with this patch version.

I will apply it shortly.

Thanks.

Signature · 2 lines
Best Regards
Masahiro Yamada
#25 lore raw
In reply to Nick Desaulniers
Quoted 10 lines · Nick Desaulniers

Added to kbuild documentation. Provides more official info on building kernels with Clang and LLVM than our wiki.

---

Applied to linux-kbuild.

Thanks.

Quoted 131 lines

Changes V2 -> V3:
* Drop Randy's Suggested-by tag. Sorry Randy, I do appreciate the review though.
* Add F: line to MAINTAINERS.

Changes V1 -> V2:
* s/On going/ongoing/
* add Randy's Suggested-by
* add Nathan and Sedat's Reviewed-by
* Upgrade Kees' Sugguested-by to Reviewed-by
* s/suffix/prefix/

 Documentation/kbuild/index.rst |  1 +
 Documentation/kbuild/llvm.rst  | 80 ++++++++++++++++++++++++++++++++++
 MAINTAINERS                    |  1 +
 3 files changed, 82 insertions(+)
 create mode 100644 Documentation/kbuild/llvm.rst
Documentation/kbuild/index.rst +1 -0
index 0f144fad99a6..3882bd5f7728 100644
@@ -19,6 +19,7 @@ Kernel Build System
 
     issues
     reproducible-builds
+    llvm
 
 .. only::  subproject and html
 
Documentation/kbuild/llvm.rst new file +80 -0
new file mode 100644
index 000000000000..d6c79eb4e23e
@@ -0,0 +1,80 @@
+==============================
+Building Linux with Clang/LLVM
+==============================
+
+This document covers how to build the Linux kernel with Clang and LLVM
+utilities.
+
+About
+-----
+
+The Linux kernel has always traditionally been compiled with GNU toolchains
+such as GCC and binutils. Ongoing work has allowed for `Clang
+<https://clang.llvm.org/>`_ and `LLVM <https://llvm.org/>`_ utilities to be
+used as viable substitutes. Distributions such as `Android
+<https://www.android.com/>`_, `ChromeOS
+<https://www.chromium.org/chromium-os>`_, and `OpenMandriva
+<https://www.openmandriva.org/>`_ use Clang built kernels.  `LLVM is a
+collection of toolchain components implemented in terms of C++ objects
+<https://www.aosabook.org/en/llvm.html>`_. Clang is a front-end to LLVM that
+supports C and the GNU C extensions required by the kernel, and is pronounced
+"klang," not "see-lang."
+
+Clang
+-----
+
+The compiler used can be swapped out via `CC=` command line argument to `make`.
+`CC=` should be set when selecting a config and during a build.
+
+       make CC=clang defconfig
+
+       make CC=clang
+
+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
+
+`CROSS_COMPILE` is not used to prefix the Clang compiler binary, instead
+`CROSS_COMPILE` is used to set a command line flag: `--target <triple>`. For
+example:
+
+       clang --target aarch64-linux-gnu foo.c
+
+LLVM Utilities
+--------------
+
+LLVM has substitutes for GNU binutils utilities. These can be invoked as
+additional parameters to `make`.
+
+       make CC=clang AS=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip \\
+         OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump OBJSIZE=llvm-objsize \\
+         READELF=llvm-readelf HOSTCC=clang HOSTCXX=clang++ HOSTAR=llvm-ar \\
+         HOSTLD=ld.lld
+
+Getting Help
+------------
+
+- `Website <https://clangbuiltlinux.github.io/>`_
+- `Mailing List <https://groups.google.com/forum/#!forum/clang-built-linux>`_: <[email protected]>
+- `Issue Tracker <https://github.com/ClangBuiltLinux/linux/issues>`_
+- IRC: #clangbuiltlinux on chat.freenode.net
+- `Telegram <https://t.me/ClangBuiltLinux>`_: @ClangBuiltLinux
+- `Wiki <https://github.com/ClangBuiltLinux/linux/wiki>`_
+- `Beginner Bugs <https://github.com/ClangBuiltLinux/linux/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22>`_
+
+Getting LLVM
+-------------
+
+- http://releases.llvm.org/download.html
+- https://github.com/llvm/llvm-project
+- https://llvm.org/docs/GettingStarted.html
+- https://llvm.org/docs/CMake.html
+- https://apt.llvm.org/
+- https://www.archlinux.org/packages/extra/x86_64/llvm/
+- https://github.com/ClangBuiltLinux/tc-build
+- https://github.com/ClangBuiltLinux/linux/wiki/Building-Clang-from-source
+- https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/
MAINTAINERS +1 -1
index 8b85f22b9b69..79e1f9bfb2b6 100644
@@ -4124,6 +4124,7 @@ B:        https://github.com/ClangBuiltLinux/linux/issues
 C:     irc://chat.freenode.net/clangbuiltlinux
 S:     Supported
 K:     \b(?i:clang|llvm)\b
+F:     Documentation/kbuild/llvm.rst
 
 CLEANCACHE API
 M:     Konrad Rzeszutek Wilk <[email protected]>
--

2.25.0.265.gbab2e86ba0-goog

Signature · 2 lines
Best Regards
Masahiro Yamada