]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - config/kernel-objtool.m4
ztest: use ASSERT3P to compare pointers
[FreeBSD/FreeBSD.git] / config / kernel-objtool.m4
1 dnl #
2 dnl # Detect objtool functionality.
3 dnl #
4
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         ])
20 ])
21
22 dnl #
23 dnl # Check for objtool support.
24 dnl #
25 AC_DEFUN([ZFS_AC_KERNEL_SRC_OBJTOOL], [
26
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         ])
37
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         ])
50 ])
51
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])
59
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         ])
71 ])