1. 23 5月, 2021 1 次提交
  2. 09 7月, 2020 1 次提交
    • L
      Raise gcc version requirement to 4.9 · 6ec4476a
      Linus Torvalds 提交于
      I realize that we fairly recently raised it to 4.8, but the fact is, 4.9
      is a much better minimum version to target.
      
      We have a number of workarounds for actual bugs in pre-4.9 gcc versions
      (including things like internal compiler errors on ARM), but we also
      have some syntactic workarounds for lacking features.
      
      In particular, raising the minimum to 4.9 means that we can now just
      assume _Generic() exists, which is likely the much better replacement
      for a lot of very convoluted built-time magic with conditionals on
      sizeof and/or __builtin_choose_expr() with same_type() etc.
      
      Using _Generic also means that you will need to have a very recent
      version of 'sparse', but thats easy to build yourself, and much less of
      a hassle than some old gcc version can be.
      
      The latest (in a long string) of reasons for minimum compiler version
      upgrades was commit 5435f73d ("efi/x86: Fix build with gcc 4").
      
      Ard points out that RHEL 7 uses gcc-4.8, but the people who stay back on
      old RHEL versions persumably also don't build their own kernels anyway.
      And maybe they should cross-built or just have a little side affair with
      a newer compiler?
      Acked-by: NArd Biesheuvel <ardb@kernel.org>
      Acked-by: NPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      6ec4476a
  3. 08 4月, 2020 1 次提交
    • R
      linux/bits.h: add compile time sanity check of GENMASK inputs · 295bcca8
      Rikard Falkeborn 提交于
      GENMASK() and GENMASK_ULL() are supposed to be called with the high bit as
      the first argument and the low bit as the second argument.  Mixing them
      will return a mask with zero bits set.
      
      Recent commits show getting this wrong is not uncommon, see e.g.  commit
      aa4c0c90 ("net: stmmac: Fix misuses of GENMASK macro") and commit
      9bdd7bb3 ("clocksource/drivers/npcm: Fix misuse of GENMASK macro").
      
      To prevent such mistakes from appearing again, add compile time sanity
      checking to the arguments of GENMASK() and GENMASK_ULL().  If both
      arguments are known at compile time, and the low bit is higher than the
      high bit, break the build to detect the mistake immediately.
      
      Since GENMASK() is used in declarations, BUILD_BUG_ON_ZERO() must be used
      instead of BUILD_BUG_ON().
      
      __builtin_constant_p does not evaluate is argument, it only checks if it
      is a constant or not at compile time, and __builtin_choose_expr does not
      evaluate the expression that is not chosen.  Therefore, GENMASK(x++, 0)
      does only evaluate x++ once.
      
      Commit 95b980d6 ("linux/bits.h: make BIT(), GENMASK(), and friends
      available in assembly") made the macros in linux/bits.h available in
      assembly.  Since BUILD_BUG_OR_ZERO() is not asm compatible, disable the
      checks if the file is included in an asm file.
      
      Due to bugs in GCC versions before 4.9 [0], disable the check if building
      with a too old GCC compiler.
      
      [0]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=19449Signed-off-by: NRikard Falkeborn <rikard.falkeborn@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Haren Myneni <haren@us.ibm.com>
      Cc: Joe Perches <joe@perches.com>
      Cc: Johannes Berg <johannes@sipsolutions.net>
      Cc: lkml <linux-kernel@vger.kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/20200308193954.2372399-1-rikard.falkeborn@gmail.comSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      295bcca8
  4. 21 3月, 2020 1 次提交
  5. 17 7月, 2019 1 次提交
  6. 21 6月, 2018 1 次提交
新手
引导
客服 返回
顶部