Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
  1. Apr 17, 2022
  2. Apr 10, 2022
  3. Apr 03, 2022
  4. Apr 01, 2022
    • Nathan Chancellor's avatar
      kbuild: Remove '-mno-global-merge' · cf300b83
      Nathan Chancellor authored
      This flag is specific to clang, where it is only used by the 32-bit and
      64-bit ARM backends. In certain situations, the presence of this flag
      will cause a warning, as shown by commit 6580c5c1 ("um: clang: Strip
      out -mno-global-merge from USER_CFLAGS").
      
      Since commit 61163efa
      
       ("kbuild: LLVMLinux: Add Kbuild support for
      building kernel with Clang") that added this flag back in 2014, there
      have been quite a few changes to the GlobalMerge pass in LLVM. Building
      several different ARCH=arm and ARCH=arm64 configurations with LLVM 11
      (minimum) and 15 (current main version) with this flag removed (i.e.,
      with the default of '-mglobal-merge') reveals no modpost warnings, so it
      is likely that the issue noted in the comment is no longer relevant due
      to changes in LLVM or modpost, meaning this flag can be removed.
      
      If any new warnings show up that are a result of the removal of this
      flag, it can be added back under arch/arm{,64}/Makefile to avoid
      warnings on other architectures.
      
      Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
      Tested-by: default avatarDavid Gow <davidgow@google.com>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Tested-by: default avatarSedat Dilek <sedat.dilek@gmail.com>
      Reviewed-by: default avatarSedat Dilek <sedat.dilek@gmail.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      cf300b83
  5. Mar 30, 2022
    • Nathan Chancellor's avatar
      kbuild: Make $(LLVM) more flexible · e9c28192
      Nathan Chancellor authored
      The LLVM make variable allows a developer to quickly switch between the
      GNU and LLVM tools. However, it does not handle versioned binaries, such
      as the ones shipped by Debian, as LLVM=1 just defines the tool variables
      with the unversioned binaries.
      
      There was some discussion during the review of the patch that introduces
      LLVM=1 around versioned binaries, ultimately coming to the conclusion
      that developers can just add the folder that contains the unversioned
      binaries to their PATH, as Debian's versioned suffixed binaries are
      really just symlinks to the unversioned binaries in /usr/lib/llvm-#/bin:
      
      $ realpath /usr/bin/clang-14
      /usr/lib/llvm-14/bin/clang
      
      $ PATH=/usr/lib/llvm-14/bin:$PATH make ... LLVM=1
      
      However, that can be cumbersome to developers who are constantly testing
      series with different toolchains and versions. It is simple enough to
      support these versioned binaries directly in the Kbuild system by
      allowing the developer to specify the version suffix with LLVM=, which
      is shorter than the above suggestion:
      
      $ make ... LLVM=-14
      
      It does not change the meaning of LLVM=1 (which will continue to use
      unversioned binaries) and it does not add too much additional complexity
      to the existing $(LLVM) code, while allowing developers to quickly test
      their series with different versions of the whole LLVM suite of tools.
      
      Some developers may build LLVM from source but not add the binaries to
      their PATH, as they may not want to use that toolchain systemwide.
      Support those developers by allowing them to supply the directory that
      the LLVM tools are available in, as it is no more complex to support
      than the version suffix change above.
      
      $ make ... LLVM=/path/to/llvm/
      
      Update and reorder the documentation to reflect these new additions.
      At the same time, notate that LLVM=0 is not the same as just omitting it
      altogether, which has confused people in the past.
      
      Link: https://lore.kernel.org/r/20200317215515.226917-1-ndesaulniers@google.com/
      Link: https://lore.kernel.org/r/20220224151322.072632223@infradead.org/
      
      
      Suggested-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Suggested-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      e9c28192
  6. Mar 20, 2022
  7. Mar 13, 2022
  8. Mar 06, 2022
  9. Feb 27, 2022
  10. Feb 20, 2022
  11. Feb 14, 2022
    • Masahiro Yamada's avatar
      kbuild: replace $(if A,A,B) with $(or A,B) · 5c816641
      Masahiro Yamada authored
      
      $(or ...) is available since GNU Make 3.81, and useful to shorten the
      code in some places.
      
      Covert as follows:
      
        $(if A,A,B)  -->  $(or A,B)
      
      This patch also converts:
      
        $(if A, A, B) --> $(or A, B)
      
      Strictly speaking, the latter is not an equivalent conversion because
      GNU Make keeps spaces after commas; if A is not empty, $(if A, A, B)
      expands to " A", while $(or A, B) expands to "A".
      
      Anyway, preceding spaces are not significant in the code hunks I touched.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNicolas Schier <nicolas@fjasle.eu>
      5c816641
  12. Feb 13, 2022
  13. Feb 06, 2022
  14. Jan 30, 2022
  15. Jan 23, 2022
  16. Jan 22, 2022
  17. Jan 09, 2022
  18. Jan 08, 2022
    • Masahiro Yamada's avatar
      kbuild: do not quote string values in include/config/auto.conf · 129ab0d2
      Masahiro Yamada authored
      
      The previous commit fixed up all shell scripts to not include
      include/config/auto.conf.
      
      Now that include/config/auto.conf is only included by Makefiles,
      we can change it into a more Make-friendly form.
      
      Previously, Kconfig output string values enclosed with double-quotes
      (both in the .config and include/config/auto.conf):
      
          CONFIG_X="foo bar"
      
      Unlike shell, Make handles double-quotes (and single-quotes as well)
      verbatim. We must rip them off when used.
      
      There are some patterns:
      
        [1] $(patsubst "%",%,$(CONFIG_X))
        [2] $(CONFIG_X:"%"=%)
        [3] $(subst ",,$(CONFIG_X))
        [4] $(shell echo $(CONFIG_X))
      
      These are not only ugly, but also fragile.
      
      [1] and [2] do not work if the value contains spaces, like
         CONFIG_X=" foo bar "
      
      [3] does not work correctly if the value contains double-quotes like
         CONFIG_X="foo\"bar"
      
      [4] seems to work better, but has a cost of forking a process.
      
      Anyway, quoted strings were always PITA for our Makefiles.
      
      This commit changes Kconfig to stop quoting in include/config/auto.conf.
      
      These are the string type symbols referenced in Makefiles or scripts:
      
          ACPI_CUSTOM_DSDT_FILE
          ARC_BUILTIN_DTB_NAME
          ARC_TUNE_MCPU
          BUILTIN_DTB_SOURCE
          CC_IMPLICIT_FALLTHROUGH
          CC_VERSION_TEXT
          CFG80211_EXTRA_REGDB_KEYDIR
          EXTRA_FIRMWARE
          EXTRA_FIRMWARE_DIR
          EXTRA_TARGETS
          H8300_BUILTIN_DTB
          INITRAMFS_SOURCE
          LOCALVERSION
          MODULE_SIG_HASH
          MODULE_SIG_KEY
          NDS32_BUILTIN_DTB
          NIOS2_DTB_SOURCE
          OPENRISC_BUILTIN_DTB
          SOC_CANAAN_K210_DTB_SOURCE
          SYSTEM_BLACKLIST_HASH_LIST
          SYSTEM_REVOCATION_KEYS
          SYSTEM_TRUSTED_KEYS
          TARGET_CPU
          UNUSED_KSYMS_WHITELIST
          XILINX_MICROBLAZE0_FAMILY
          XILINX_MICROBLAZE0_HW_VER
          XTENSA_VARIANT_NAME
      
      I checked them one by one, and fixed up the code where necessary.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      129ab0d2
    • Masahiro Yamada's avatar
      certs: refactor file cleaning · 5cca3606
      Masahiro Yamada authored
      
      'make clean' removes files listed in 'targets'. It is redundant to
      specify both 'targets' and 'clean-files'.
      
      Move 'targets' assignments out of the ifeq-conditionals so
      scripts/Makefile.clean can see them.
      
      One effective change is that certs/certs/signing_key.x509 is now
      deleted by 'make clean' instead of 'make mrproper. This certificate
      is embedded in the kernel. It is not used in any way by external
      module builds.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNicolas Schier <n.schier@avm.de>
      5cca3606
    • Masahiro Yamada's avatar
      kbuild: remove headers_check stub · 4fbce819
      Masahiro Yamada authored
      
      Linux 5.15 is out. Remove this stub now.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      4fbce819
  19. Jan 02, 2022
  20. Dec 26, 2021
  21. Dec 19, 2021
  22. Dec 12, 2021
  23. Dec 08, 2021
  24. Dec 06, 2021
  25. Dec 05, 2021
  26. Nov 28, 2021
  27. Nov 21, 2021
  28. Nov 15, 2021
  29. Nov 14, 2021
  30. Nov 06, 2021
    • Kees Cook's avatar
      Compiler Attributes: add __alloc_size() for better bounds checking · 86cffecd
      Kees Cook authored
      GCC and Clang can use the "alloc_size" attribute to better inform the
      results of __builtin_object_size() (for compile-time constant values).
      Clang can additionally use alloc_size to inform the results of
      __builtin_dynamic_object_size() (for run-time values).
      
      Because GCC sees the frequent use of struct_size() as an allocator size
      argument, and notices it can return SIZE_MAX (the overflow indication),
      it complains about these call sites overflowing (since SIZE_MAX is
      greater than the default -Walloc-size-larger-than=PTRDIFF_MAX).  This
      isn't helpful since we already know a SIZE_MAX will be caught at
      run-time (this was an intentional design).  To deal with this, we must
      disable this check as it is both a false positive and redundant.  (Clang
      does not have this warning option.)
      
      Unfortunately, just checking the -Wno-alloc-size-larger-than is not
      sufficient to make the __alloc_size attribute behave correctly under
      older GCC versions.  The attr...
      86cffecd