Go to file
Masahiro Yamada 6072b2c49d kbuild: warn if a different compiler is used for external module builds
It is always safe to use the same compiler for the kernel and external
modules, but in reality, some distributions such as Fedora release a
different version of GCC from the one used for building the kernel.

There was a long discussion about mixing different compilers [1].

I do not repeat it here, but at least, showing a heads up in that
case is better than nothing.

Linus suggested [2]:
  And a warning might be more palatable even if different compiler
  version work fine together. Just a heads up on "it looks like you
  might be mixing compiler versions" is a valid note, and isn't
  necessarily wrong. Even when they work well together, maybe you want
  to have people at least _aware_ of it.

This commit shows a warning unless the compiler is exactly the same.

  warning: the compiler differs from the one used to build the kernel
    The kernel was built by: gcc (GCC) 11.1.1 20210531 (Red Hat 11.1.1-3)
    You are using:           gcc (GCC) 11.2.1 20210728 (Red Hat 11.2.1-1)

Check the difference, and if it is OK with you, please proceed at your
risk.

To avoid the locale issue as in commit bcbcf50f52 ("kbuild: fix
ld-version.sh to not be affected by locale"), pass LC_ALL=C to
"$(CC) --version".

[1] https://lore.kernel.org/linux-hardening/efe6b039a544da8215d5e54aa7c4b6d1986fc2b0.1611607264.git.jpoimboe@redhat.com/
[2] https://lore.kernel.org/lkml/CAHk-=wgjwhDy-y4mQh34L+2aF=n6BjzHdqAW2=8wri5x7O04pA@mail.gmail.com/

Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-08-10 09:13:25 +09:00
arch kbuild: do not require sub-make for separate output tree builds 2021-08-10 08:23:39 +09:00
block block-5.14-2021-08-07 2021-08-07 10:26:21 -07:00
certs Kbuild updates for v5.13 (2nd) 2021-05-08 10:00:11 -07:00
crypto Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2021-07-09 11:00:44 -07:00
Documentation docs: networking: netdevsim rules 2021-08-04 12:43:27 +01:00
drivers Char/Misc driver fixes for 5.14-rc5 2021-08-08 10:41:49 -07:00
fs io_uring-5.14-2021-08-07 2021-08-07 10:34:26 -07:00
include TTY/Serial fixes for 5.14-rc5 2021-08-08 10:23:13 -07:00
init Revert "mm/slub: use stackdepot to save stack trace in objects" 2021-07-17 13:27:00 -07:00
ipc Merge branch 'akpm' (patches from Andrew) 2021-07-02 12:08:10 -07:00
kernel A single timer fix: 2021-08-08 11:53:30 -07:00
lib lib/test_string.c: move string selftest in the Runtime Testing menu 2021-07-30 10:14:39 -07:00
LICENSES LICENSES/dual/CC-BY-4.0: Git rid of "smart quotes" 2021-07-15 06:31:24 -06:00
mm mm/memcg: fix NULL pointer dereference in memcg_slab_free_hook() 2021-07-30 10:14:39 -07:00
net Networking fixes for 5.14-rc5, including fixes from ipsec. 2021-08-05 12:26:00 -07:00
samples Networking fixes for 5.14-rc2, including fixes from bpf and netfilter. 2021-07-14 09:24:32 -07:00
scripts scripts: make some scripts executable 2021-08-10 09:13:25 +09:00
security selinux/stable-5.14 PR 20210805 2021-08-05 12:06:31 -07:00
sound sound fixes for 5.14-rc5 2021-08-06 10:50:26 -07:00
tools Networking fixes for 5.14-rc5, including fixes from ipsec. 2021-08-05 12:26:00 -07:00
usr .gitignore: prefix local generated files with a slash 2021-05-02 00:43:35 +09:00
virt KVM: Do not leak memory for duplicate debugfs directories 2021-08-04 06:02:03 -04:00
.clang-format clang-format: Update with the latest for_each macro list 2021-05-12 23:32:39 +02:00
.cocciconfig
.get_maintainer.ignore
.gitattributes .gitattributes: use 'dts' diff driver for dts files 2019-12-04 19:44:11 -08:00
.gitignore .gitignore: ignore only top-level modules.builtin 2021-05-02 00:43:35 +09:00
.mailmap m68k updates for v5.14 2021-06-28 14:01:03 -07:00
COPYING COPYING: state that all contributions really are covered by this file 2020-02-10 13:32:20 -08:00
CREDITS MAINTAINERS: move Murali Karicheri to credits 2021-04-29 15:47:30 -07:00
Kbuild kbuild: rename hostprogs-y/always to hostprogs/always-y 2020-02-04 01:53:07 +09:00
Kconfig kbuild: ensure full rebuild when the compiler is updated 2020-05-12 13:28:33 +09:00
MAINTAINERS Networking fixes for 5.14-rc4, including fixes from bpf, can, WiFi (mac80211) 2021-07-30 16:01:36 -07:00
Makefile kbuild: warn if a different compiler is used for external module builds 2021-08-10 09:13:25 +09:00
README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.