1. 11 Mar, 2024 1 commit
    • Masahiro Yamada's avatar
      kbuild: remove GCC's default -Wpacked-bitfield-compat flag · 44929bfa
      Masahiro Yamada authored
      Commit 4a5838ad ("kbuild: Add extra gcc checks") added the
      -Wpacked-bitfield-compat flag, but there is no need to add it
      explicitly.
      
      GCC manual says:
        "This warning is enabled by default. Use -Wno-packed-bitfield-compat
         to disable this warning."
      
      The test code in the manual:
      
        struct foo
        {
          char a:4;
          char b:8;
        } __attribute__ ((packed));
      
      ... emits "note: offset of packed bit-field ‘b’ has changed in GCC 4.4"
      without W=3.
      
      Let's remove it, as it is a default with GCC.
      
      Clang does not support this flag, so its removal will not affect Clang
      builds.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNathan Chancellor <nathan@kernel.org>
      44929bfa
  2. 10 Mar, 2024 3 commits
    • Masahiro Yamada's avatar
      kbuild: unexport abs_srctree and abs_objtree · e2bad142
      Masahiro Yamada authored
      Commit 25b146c5 ("kbuild: allow Kbuild to start from any directory")
      exported abs_srctree and abs_objtree to avoid recomputation after the
      sub-make. However, this approach turned out to be fragile.
      
      Commit 5fa94ceb ("kbuild: set correct abs_srctree and abs_objtree
      for package builds") moved them above "ifneq ($(sub_make_done),1)",
      eliminating the need for exporting them.
      
      These are only needed in the top Makefile. If an absolute path is
      required in sub-directories, you can use $(abspath ) or $(realpath )
      as needed.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNicolas Schier <nicolas@fjasle.eu>
      e2bad142
    • Nathan Chancellor's avatar
      kbuild: Move -Wenum-{compare-conditional,enum-conversion} into W=1 · 75b5ab13
      Nathan Chancellor authored
      Clang enables -Wenum-enum-conversion and -Wenum-compare-conditional
      under -Wenum-conversion. A recent change in Clang strengthened these
      warnings and they appear frequently in common builds, primarily due to
      several instances in common headers but there are quite a few drivers
      that have individual instances as well.
      
        include/linux/vmstat.h:508:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
          508 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
              |                            ~~~~~~~~~~~~~~~~~~~~~ ^
          509 |                            item];
              |                            ~~~~
      
        drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c:955:24: warning: conditional expression between different enumeration types ('enum iwl_mac_beacon_flags' and 'enum iwl_mac_beacon_flags_v1') [-Wenum-compare-conditional]
          955 |                 flags |= is_new_rate ? IWL_MAC_BEACON_CCK
              |                                      ^ ~~~~~~~~~~~~~~~~~~
          956 |                           : IWL_MAC_BEACON_CCK_V1;
              |                             ~~~~~~~~~~~~~~~~~~~~~
        drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c:1120:21: warning: conditional expression between different enumeration types ('enum iwl_mac_beacon_flags' and 'enum iwl_mac_beacon_flags_v1') [-Wenum-compare-conditional]
         1120 |                                                0) > 10 ?
              |                                                        ^
         1121 |                         IWL_MAC_BEACON_FILS :
              |                         ~~~~~~~~~~~~~~~~~~~
         1122 |                         IWL_MAC_BEACON_FILS_V1;
              |                         ~~~~~~~~~~~~~~~~~~~~~~
      
      Doing arithmetic between or returning two different types of enums could
      be a bug, so each of the instance of the warning needs to be evaluated.
      Unfortunately, as mentioned above, there are many instances of this
      warning in many different configurations, which can break the build when
      CONFIG_WERROR is enabled.
      
      To avoid introducing new instances of the warnings while cleaning up the
      disruption for the majority of users, disable these warnings for the
      default build while leaving them on for W=1 builds.
      
      Cc: stable@vger.kernel.org
      Closes: https://github.com/ClangBuiltLinux/linux/issues/2002
      Link: https://github.com/llvm/llvm-project/commit/8c2ae42b3e1c6aa7c18f873edcebff7c0b45a37eAcked-by: default avatarYonghong Song <yonghong.song@linux.dev>
      Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
      Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      75b5ab13
    • Masahiro Yamada's avatar
      kconfig: remove named choice support · c83f0209
      Masahiro Yamada authored
      Commit 5a1aa8a1 ("kconfig: add named choice group") did not provide
      enough explanation regarding its benefits. A use case was found in
      another project [1] sometime later, this feature has never been used in
      the kernel.
      
      [1]: https://lore.kernel.org/all/201012150034.01356.yann.morin.1998@anciens.enib.fr/Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNicolas Schier <nicolas@fjasle.eu>
      c83f0209
  3. 09 Mar, 2024 3 commits
  4. 25 Feb, 2024 1 commit
    • Petr Pavlu's avatar
      kbuild: Use -fmin-function-alignment when available · 5270316c
      Petr Pavlu authored
      GCC recently added option -fmin-function-alignment, which should appear
      in GCC 14. Unlike -falign-functions, this option causes all functions to
      be aligned at the specified value, including the cold ones.
      
      In particular, when an arm64 kernel is built with
      DYNAMIC_FTRACE_WITH_CALL_OPS=y, the 8-byte function alignment is
      required for correct functionality. This was done by -falign-functions=8
      and having workarounds in the kernel to force the compiler to follow
      this alignment. The new -fmin-function-alignment option directly
      guarantees it.
      
      Detect availability of -fmin-function-alignment and use it instead of
      -falign-functions when present. Introduce CC_HAS_SANE_FUNCTION_ALIGNMENT
      and enable __cold to work as expected when it is set.
      Signed-off-by: default avatarPetr Pavlu <petr.pavlu@suse.com>
      Reviewed-by: default avatarNathan Chancellor <nathan@kernel.org>
      Acked-by: default avatarMark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      5270316c
  5. 23 Feb, 2024 4 commits
  6. 20 Feb, 2024 10 commits
  7. 19 Feb, 2024 18 commits