]> git.baikalelectronics.ru Git - kernel.git/commit
include/linux/compiler*.h: make compiler-*.h mutually exclusive
authorNick Desaulniers <ndesaulniers@google.com>
Wed, 22 Aug 2018 23:37:24 +0000 (16:37 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 23 Aug 2018 00:31:34 +0000 (17:31 -0700)
commitbf82e747dd2a7bce6a2936c011df76e3e7dec5ef
tree4805bf7e3cb7ec4e727aba8e62f9211e9001a760
parent5fdf50992c28388c682a155e7b475732c5c07cfb
include/linux/compiler*.h: make compiler-*.h mutually exclusive

Commit 46ed35d9f3fa ("Raise the minimum required gcc version to 4.6")
recently exposed a brittle part of the build for supporting non-gcc
compilers.

Both Clang and ICC define __GNUC__, __GNUC_MINOR__, and
__GNUC_PATCHLEVEL__ for quick compatibility with code bases that haven't
added compiler specific checks for __clang__ or __INTEL_COMPILER.

This is brittle, as they happened to get compatibility by posing as a
certain version of GCC.  This broke when upgrading the minimal version
of GCC required to build the kernel, to a version above what ICC and
Clang claim to be.

Rather than always including compiler-gcc.h then undefining or
redefining macros in compiler-intel.h or compiler-clang.h, let's
separate out the compiler specific macro definitions into mutually
exclusive headers, do more proper compiler detection, and keep shared
definitions in compiler_types.h.

Fixes: 46ed35d9f3fa ("Raise the minimum required gcc version to 4.6")
Reported-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Suggested-by: Eli Friedman <efriedma@codeaurora.org>
Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/arm/kernel/asm-offsets.c
drivers/gpu/drm/i915/i915_utils.h
drivers/watchdog/kempld_wdt.c
include/linux/compiler-clang.h
include/linux/compiler-gcc.h
include/linux/compiler-intel.h
include/linux/compiler_types.h
mm/ksm.c
mm/migrate.c