Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
  1. Mar 31, 2022
  2. 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=...
      e9c28192
    • Masahiro Yamada's avatar
      kbuild: add --target to correctly cross-compile UAPI headers with Clang · 9fbed27a
      Masahiro Yamada authored
      When you compile-test UAPI headers (CONFIG_UAPI_HEADER_TEST=y) with
      Clang, they are currently compiled for the host target (likely x86_64)
      regardless of the given ARCH=.
      
      In fact, some exported headers include libc headers. For example,
      include/uapi/linux/agpgart.h includes <stdlib.h> after being exported.
      The header search paths should match to the target we are compiling
      them for.
      
      Pick up the --target triple from KBUILD_CFLAGS in the same ways as
      commit 7f58b487
      
       ("kbuild: make Clang build userprogs for target
      architecture").
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNathan Chancellor <nathan@kernel.org>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      9fbed27a
    • Masahiro Yamada's avatar
      fixdep: use fflush() and ferror() to ensure successful write to files · 69304379
      Masahiro Yamada authored
      Currently, fixdep checks the return value from (v)printf(), but it does
      not ensure the complete write to the .cmd file.
      
      printf() just writes data to the internal buffer, which usually succeeds.
      (Of course, it may fail for another reason, for example when the file
      descriptor is closed, but that is another story.)
      
      When the buffer (4k?) is full, an actual write occurs, and printf() may
      really fail. One of typical cases is "No space left on device" when the
      disk is full.
      
      The data remaining in the buffer will be pushed out to the file when
      the program exits, but we never know if it is successful.
      
      One straight-forward fix would be to add the following code at the end
      of the program.
      
         ret = fflush(stdout);
         if (ret < 0) {
                /* error handling */
         }
      
      However, it is tedious to check the return code in all the call sites
      of printf(), fflush(), fclose(), and whatever can cause actual writes
      to the end device. Doing that lets the ...
      69304379
    • Masahiro Yamada's avatar
      arch: syscalls: simplify uapi/kapi directory creation · bbc90bc1
      Masahiro Yamada authored
      
      $(shell ...) expands to empty. There is no need to assign it to _dummy.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Acked-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      bbc90bc1