]> granicus.if.org Git - spl/commitdiff
Add handling for kernel 4.7's CONFIG_TRIM_UNUSED_KSYMS
authorNikolay Borisov <n.borisov.lkml@gmail.com>
Fri, 29 Jul 2016 15:48:33 +0000 (18:48 +0300)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 1 Aug 2016 19:43:01 +0000 (12:43 -0700)
Kernel 4.7 added the option to trim the unused exported symbols. In
my testing this showed to be problematic since the PDE_DATA function
was considered unused and as such was trimmed. This in turn caused the
respective test during spl's configure stage to falsely detect that
PDE_DATA is not defined, which in turn caused build failures later.

Handle this situation by adding detection whether CONFIG_TRIM_UNUSED_KSYMS
is enabled and refuse to build against a kernel which has it enabled

Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #565

config/spl-build.m4

index e9eb77861ee81f33ce733323d763652db069f03f..3ed0e8fd0d629c04119ceda6b56ddcea6eaa9c44 100644 (file)
@@ -24,6 +24,7 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
        SPL_AC_ATOMIC_SPINLOCK
        SPL_AC_SHRINKER_CALLBACK
        SPL_AC_CTL_NAME
+       SPL_AC_CONFIG_TRIM_UNUSED_KSYMS
        SPL_AC_PDE_DATA
        SPL_AC_SET_FS_PWD_WITH_CONST
        SPL_AC_2ARGS_VFS_UNLINK
@@ -1248,6 +1249,26 @@ AC_DEFUN([SPL_AC_CONFIG_ZLIB_DEFLATE], [
        ])
 ])
 
+dnl #
+dnl # config trim unused symbols,
+dnl # Verify the kernel has CONFIG_TRIM_UNUSED_KSYMS DISABLED.
+dnl #
+AC_DEFUN([SPL_AC_CONFIG_TRIM_UNUSED_KSYMS], [
+       AC_MSG_CHECKING([whether CONFIG_TRIM_UNUSED_KSYM is disabled])
+       SPL_LINUX_TRY_COMPILE([
+               #if defined(CONFIG_TRIM_UNUSED_KSYMS)
+               #error CONFIG_TRIM_UNUSED_KSYMS not defined
+               #endif
+       ],[ ],[
+               AC_MSG_RESULT([yes])
+       ],[
+               AC_MSG_RESULT([no])
+               AC_MSG_ERROR([
+       *** This kernel has unused symbols trimming enabled, please disable.
+       *** Rebuild the kernel with CONFIG_TRIM_UNUSED_KSYMS=n set.])
+       ])
+])
+
 dnl #
 dnl # 2.6.39 API compat,
 dnl # The function zlib_deflate_workspacesize() now take 2 arguments.