From 8c7d604c62bf621c11faf3abe64cfa94bd12b45b Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 2 Nov 2020 21:39:50 +0000 Subject: Linux 5.10 compat: frame.h renamed objtool.h In Linux 5.10 the linux/frame.h header was renamed linux/objtool.h. Add a configure check to detect and use the correctly named header. Signed-off-by: Brian Behlendorf Closes #11085 --- config/kernel-objtool.m4 | 25 +++++++++++++++++++++++++ config/kernel.m4 | 1 + include/sys/frame.h | 4 ++++ 3 files changed, 30 insertions(+) diff --git a/config/kernel-objtool.m4 b/config/kernel-objtool.m4 index c560c4195..f9f9d657d 100644 --- a/config/kernel-objtool.m4 +++ b/config/kernel-objtool.m4 @@ -1,3 +1,24 @@ +dnl # +dnl # Detect objtool functionality. +dnl # + +dnl # +dnl # Kernel 5.10: linux/frame.h was renamed linux/objtool.h +dnl # +AC_DEFUN([ZFS_AC_KERNEL_OBJTOOL_HEADER], [ + AC_MSG_CHECKING([whether objtool header is available]) + ZFS_LINUX_TRY_COMPILE([ + #include + ],[ + ],[ + AC_DEFINE(HAVE_KERNEL_OBJTOOL_HEADER, 1, + [kernel has linux/objtool.h]) + AC_MSG_RESULT(linux/objtool.h) + ],[ + AC_MSG_RESULT(linux/frame.h) + ]) +]) + dnl # dnl # Check for objtool support. dnl # @@ -16,7 +37,11 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_OBJTOOL], [ dnl # 4.6 API added STACK_FRAME_NON_STANDARD macro ZFS_LINUX_TEST_SRC([stack_frame_non_standard], [ + #ifdef HAVE_KERNEL_OBJTOOL_HEADER + #include + #else #include + #endif ],[ #if !defined(STACK_FRAME_NON_STANDARD) #error "STACK_FRAME_NON_STANDARD is not defined." diff --git a/config/kernel.m4 b/config/kernel.m4 index ec52f014a..bbfbeb39b 100644 --- a/config/kernel.m4 +++ b/config/kernel.m4 @@ -13,6 +13,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [ dnl # Sequential ZFS_LINUX_TRY_COMPILE tests ZFS_AC_KERNEL_FPU_HEADER + ZFS_AC_KERNEL_OBJTOOL_HEADER ZFS_AC_KERNEL_WAIT_QUEUE_ENTRY_T ZFS_AC_KERNEL_MISC_MINOR ZFS_AC_KERNEL_DECLARE_EVENT_CLASS diff --git a/include/sys/frame.h b/include/sys/frame.h index b6bbaa79b..caae85142 100644 --- a/include/sys/frame.h +++ b/include/sys/frame.h @@ -25,7 +25,11 @@ extern "C" { #if defined(__KERNEL__) && defined(HAVE_KERNEL_OBJTOOL) && \ defined(HAVE_STACK_FRAME_NON_STANDARD) +#if defined(HAVE_KERNEL_OBJTOOL_HEADER) +#include +#else #include +#endif #else #define STACK_FRAME_NON_STANDARD(func) #endif -- cgit v1.2.3