linux-stable/Documentation/process
Nathan Chancellor df05c0e949 Documentation: Raise the minimum supported version of LLVM to 11.0.0
LLVM versions prior to 11.0.0 have a harder time with dead code
elimination, which can cause issues with commonly used expressions such
as BUILD_BUG_ON and the bitmask functions/macros in bitfield.h (see the
first two issues links below).

Whenever there is an issue within LLVM that has been resolved in a later
release, the only course of action is to gate the problematic
configuration or source code on the toolchain verson or raise the
minimum supported version of LLVM for building the kernel, as LLVM has a
limited support lifetime compared to GCC. GCC major releases will
typically see a few point releases across a two year period on average
whereas LLVM major releases are only supported until the next major
release and will only see one or two point releases within that
timeframe. For example, GCC 8.1 was released in May 2018 and GCC 8.5 was
released in May 2021, whereas LLVM 12.0.0 was released in April 2021 and
its only point release, 12.0.1, was released in July 2021, giving a
minimal window for fixes to be backported.

To resolve these build errors around improper dead code elimination,
raise the minimum supported version of LLVM for building the kernel to
11.0.0. Doing so is a more proper solution than mucking around with core
kernel macros that have always worked with GCC or disabling drivers for
using these macros in a proper manner. This type of issue may continue
to crop up and require patching, which creates more debt for bumping the
minimum supported version in the future.

This should have a minimal impact to distributions. Using a script to
pull several different Docker images and check the output of
'clang --version':

archlinux:latest: clang version 13.0.0

debian:oldoldstable-slim: clang version 3.8.1-24 (tags/RELEASE_381/final)
debian:oldstable-slim: clang version 7.0.1-8+deb10u2 (tags/RELEASE_701/final)
debian:stable-slim: Debian clang version 11.0.1-2
debian:testing-slim: Debian clang version 11.1.0-4
debian:unstable-slim: Debian clang version 11.1.0-4

fedora:34: clang version 12.0.1 (Fedora 12.0.1-1.fc34)
fedora:latest: clang version 13.0.0 (Fedora 13.0.0-3.fc35)
fedora:rawhide: clang version 13.0.0 (Fedora 13.0.0-5.fc36)

opensuse/leap:15.2: clang version 9.0.1
opensuse/leap:latest: clang version 11.0.1
opensuse/tumbleweed:latest: clang version 13.0.0

ubuntu:bionic: clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
ubuntu:latest: clang version 10.0.0-4ubuntu1
ubuntu:hirsute: Ubuntu clang version 12.0.0-3ubuntu1~21.04.2
ubuntu:rolling: Ubuntu clang version 13.0.0-2
ubuntu:devel: Ubuntu clang version 13.0.0-9

In every case, the distribution's version of clang is either older than
the current minimum supported version of LLVM 10.0.1 or equal to or
greater than the proposed 11.0.0 so nothing should change.

Another benefit of this change is LLVM=1 works better with arm64 and
x86_64 since commit f12b034afe ("scripts/Makefile.clang: default to
LLVM_IAS=1") enabled the integrated assembler by default, which only
works well with clang 11+ (clang-10 required it to be disabled to
successfully build a kernel).

Link: https://github.com/ClangBuiltLinux/linux/issues/1293
Link: https://github.com/ClangBuiltLinux/linux/issues/1506
Link: https://github.com/ClangBuiltLinux/linux/issues/1511
Link: fa496ce3c6
Link: https://groups.google.com/g/clang-built-linux/c/mPQb9_ZWW0s/m/W7o6S-QTBAAJ
Link: https://github.com/ClangBuiltLinux/misc-scripts
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Miguel Ojeda <ojeda@kernel.org>
Reviewed-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-12-02 17:24:32 +09:00
..
1.Intro.rst
2.Process.rst Documentation: process: step 2: Link to email list fixed. 2020-09-03 10:31:03 -06:00
3.Early-stage.rst Replace HTTP links with HTTPS ones: documentation 2020-06-08 09:30:19 -06:00
4.Coding.rst doc: use KCFLAGS instead of EXTRA_CFLAGS to pass flags from command line 2021-02-22 13:59:10 -07:00
5.Posting.rst
6.Followthrough.rst
7.AdvancedTopics.rst Replace HTTP links with HTTPS ones: documentation 2020-06-08 09:30:19 -06:00
8.Conclusion.rst Replace HTTP links with HTTPS ones: documentation 2020-06-08 09:30:19 -06:00
adding-syscalls.rst docs: Make syscalls' helpers naming consistent 2021-02-04 14:47:24 -07:00
applying-patches.rst Documentation/process/applying-patches: Activate linux-next man hyperlink 2021-08-20 11:10:12 -06:00
botching-up-ioctls.rst Replace HTTP links with HTTPS ones: Documentation/process 2020-06-26 11:19:43 -06:00
changes.rst Documentation: Raise the minimum supported version of LLVM to 11.0.0 2021-12-02 17:24:32 +09:00
clang-format.rst Documentation: fix typos found in process, dev-tools, and doc-guide subdirectories 2020-12-03 15:55:04 -07:00
code-of-conduct-interpretation.rst
code-of-conduct.rst
coding-style.rst coding-style.rst: trivial: fix location of driver model macros 2021-10-26 09:39:49 -06:00
deprecated.rst docs: deprecated.rst: Clarify open-coded arithmetic with literals 2021-10-26 09:43:54 -06:00
development-process.rst
email-clients.rst Documentation/process: expand plain-text advice 2020-09-03 15:39:01 -06:00
embargoed-hardware-issues.rst Documentation: fix typos found in process, dev-tools, and doc-guide subdirectories 2020-12-03 15:55:04 -07:00
howto.rst docs: process/howto.rst: make sections on bug reporting match practice 2021-01-18 12:29:38 -07:00
index.rst Documentation/process: Add maintainer handbooks section 2021-09-14 14:46:49 -06:00
kernel-docs.rst Documentation: Update details of The Linux Kernel Module Programming Guide 2021-08-20 17:05:45 -06:00
kernel-driver-statement.rst
kernel-enforcement-statement.rst Documentation: drop optional BOMs 2021-05-10 15:17:34 -06:00
license-rules.rst
magic-number.rst tty: remove TTY_LDISC_MAGIC 2021-03-10 09:34:06 +01:00
maintainer-handbooks.rst Documentation/process: Add tip tree handbook 2021-09-14 14:46:49 -06:00
maintainer-pgp-guide.rst Documentation/process/maintainer-pgp-guide: Replace broken link to PGP path finder 2021-08-24 13:23:21 -06:00
maintainer-tip.rst docs: use the lore redirector everywhere 2021-10-12 13:58:19 -06:00
maintainers.rst
management-style.rst
programming-language.rst docs: programming-languages: refresh blurb on clang support 2020-10-05 09:44:11 -06:00
stable-api-nonsense.rst
stable-kernel-rules.rst docs: networking: drop special stable handling 2021-03-03 08:49:08 -08:00
submit-checklist.rst doc: use KCFLAGS instead of EXTRA_CFLAGS to pass flags from command line 2021-02-22 13:59:10 -07:00
submitting-drivers.rst docs: update file link location 2021-10-12 13:49:27 -06:00
submitting-patches.rst Documentation/process: fix a cross reference 2021-11-17 06:12:14 -07:00
volatile-considered-harmful.rst Replace HTTP links with HTTPS ones: documentation 2020-06-08 09:30:19 -06:00