mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 03:09:34 +03:00
Add support for $KERNEL_{CC,LD,LLVM} variables
Currently, $(CC), $(LD), and $(LLVM) variables aren't passed to kbuild while building modules. This causes modules to build with the default GNU GCC toolchain and prevents experimenting with other toolchains such as CLANG/LLVM. It can also lead to build failure if the CFLAGS/LDFLAGS passed are incompatible with gcc/ld. Pass $KERNEL_CC, $KERNEL_LD, and $KERNEL_LLVM as $(CC), $(LD), and $(LLVM), respectively, to kbuild for each that is defined in the environment. This should take care of the majority of alternative toolchain use cases. Reviewed-by: Damian Szuberski <szuberskidamian@gmail.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Peter Levine <plevine457@gmail.com> Closes #13046
This commit is contained in:
parent
8e94ac0e36
commit
b66140c6ad
@ -601,9 +601,15 @@ dnl #
|
||||
dnl # Used internally by ZFS_LINUX_TEST_{COMPILE,MODPOST}
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_LINUX_COMPILE], [
|
||||
AC_ARG_VAR([KERNEL_CC], [C compiler for
|
||||
building kernel modules])
|
||||
AC_ARG_VAR([KERNEL_LD], [Linker for
|
||||
building kernel modules])
|
||||
AC_ARG_VAR([KERNEL_LLVM], [Binary option to
|
||||
build kernel modules with LLVM/CLANG toolchain])
|
||||
AC_TRY_COMMAND([
|
||||
KBUILD_MODPOST_NOFINAL="$5" KBUILD_MODPOST_WARN="$6"
|
||||
make modules -k -j$TEST_JOBS -C $LINUX_OBJ $ARCH_UM
|
||||
make modules -k -j$TEST_JOBS ${KERNEL_CC:+CC=$KERNEL_CC} ${KERNEL_LD:+LD=$KERNEL_LD} ${KERNEL_LLVM:+LLVM=$KERNEL_LLVM} -C $LINUX_OBJ $ARCH_UM
|
||||
M=$PWD/$1 >$1/build.log 2>&1])
|
||||
AS_IF([AC_TRY_COMMAND([$2])], [$3], [$4])
|
||||
])
|
||||
|
@ -52,7 +52,9 @@ FMAKE = env -u MAKEFLAGS make $(FMAKEFLAGS)
|
||||
|
||||
modules-Linux:
|
||||
list='$(SUBDIR_TARGETS)'; for td in $$list; do $(MAKE) -C $$td; done
|
||||
$(MAKE) -C @LINUX_OBJ@ M="$$PWD" @KERNEL_MAKE@ CONFIG_ZFS=m modules
|
||||
$(MAKE) -C @LINUX_OBJ@ $(if @KERNEL_CC@,CC=@KERNEL_CC@) \
|
||||
$(if @KERNEL_LD@,LD=@KERNEL_LD@) $(if @KERNEL_LLVM@,LLVM=@KERNEL_LLVM@) \
|
||||
M="$$PWD" @KERNEL_MAKE@ CONFIG_ZFS=m modules
|
||||
|
||||
modules-FreeBSD:
|
||||
+$(FMAKE)
|
||||
|
Loading…
Reference in New Issue
Block a user