ztest: update ztest_dmu_snapshot_create_destroy()
[zfs.git] / config / kernel-objtool.m4
blobf9f9d657d8053e5d67090d92385c0f5d482d103f
1 dnl #
2 dnl # Detect objtool functionality.
3 dnl #
5 dnl #
6 dnl # Kernel 5.10: linux/frame.h was renamed linux/objtool.h
7 dnl #
8 AC_DEFUN([ZFS_AC_KERNEL_OBJTOOL_HEADER], [
9         AC_MSG_CHECKING([whether objtool header is available])
10         ZFS_LINUX_TRY_COMPILE([
11                 #include <linux/objtool.h>
12         ],[
13         ],[
14                 AC_DEFINE(HAVE_KERNEL_OBJTOOL_HEADER, 1,
15                     [kernel has linux/objtool.h])
16                 AC_MSG_RESULT(linux/objtool.h)
17         ],[
18                 AC_MSG_RESULT(linux/frame.h)
19         ])
22 dnl #
23 dnl # Check for objtool support.
24 dnl #
25 AC_DEFUN([ZFS_AC_KERNEL_SRC_OBJTOOL], [
27         dnl # 4.6 API for compile-time stack validation
28         ZFS_LINUX_TEST_SRC([objtool], [
29                 #undef __ASSEMBLY__
30                 #include <asm/ptrace.h>
31                 #include <asm/frame.h>
32         ],[
33                 #if !defined(FRAME_BEGIN)
34                 #error "FRAME_BEGIN is not defined"
35                 #endif
36         ])
38         dnl # 4.6 API added STACK_FRAME_NON_STANDARD macro
39         ZFS_LINUX_TEST_SRC([stack_frame_non_standard], [
40                 #ifdef HAVE_KERNEL_OBJTOOL_HEADER
41                 #include <linux/objtool.h>
42                 #else
43                 #include <linux/frame.h>
44                 #endif
45         ],[
46                 #if !defined(STACK_FRAME_NON_STANDARD)
47                 #error "STACK_FRAME_NON_STANDARD is not defined."
48                 #endif
49         ])
52 AC_DEFUN([ZFS_AC_KERNEL_OBJTOOL], [
53         AC_MSG_CHECKING(
54             [whether compile-time stack validation (objtool) is available])
55         ZFS_LINUX_TEST_RESULT([objtool], [
56                 AC_MSG_RESULT(yes)
57                 AC_DEFINE(HAVE_KERNEL_OBJTOOL, 1,
58                     [kernel does stack verification])
60                 AC_MSG_CHECKING([whether STACK_FRAME_NON_STANDARD is defined])
61                 ZFS_LINUX_TEST_RESULT([stack_frame_non_standard], [
62                         AC_MSG_RESULT(yes)
63                         AC_DEFINE(HAVE_STACK_FRAME_NON_STANDARD, 1,
64                            [STACK_FRAME_NON_STANDARD is defined])
65                 ],[
66                         AC_MSG_RESULT(no)
67                 ])
68         ],[
69                 AC_MSG_RESULT(no)
70         ])