xref: /freebsd/sys/contrib/openzfs/config/kernel-objtool.m4 (revision 6132212808e8dccedc9e5d85fea4390c2f38059a)
1dnl #
2dnl # Check for objtool support.
3dnl #
4AC_DEFUN([ZFS_AC_KERNEL_SRC_OBJTOOL], [
5
6	dnl # 4.6 API for compile-time stack validation
7	ZFS_LINUX_TEST_SRC([objtool], [
8		#undef __ASSEMBLY__
9		#include <asm/frame.h>
10	],[
11		#if !defined(FRAME_BEGIN)
12		CTASSERT(1);
13		#endif
14	])
15
16	dnl # 4.6 API added STACK_FRAME_NON_STANDARD macro
17	ZFS_LINUX_TEST_SRC([stack_frame_non_standard], [
18		#include <linux/frame.h>
19	],[
20		#if !defined(STACK_FRAME_NON_STANDARD)
21		CTASSERT(1);
22		#endif
23	])
24])
25
26AC_DEFUN([ZFS_AC_KERNEL_OBJTOOL], [
27	AC_MSG_CHECKING(
28	    [whether compile-time stack validation (objtool) is available])
29	ZFS_LINUX_TEST_RESULT([objtool], [
30		AC_MSG_RESULT(yes)
31		AC_DEFINE(HAVE_KERNEL_OBJTOOL, 1,
32		    [kernel does stack verification])
33
34		AC_MSG_CHECKING([whether STACK_FRAME_NON_STANDARD is defined])
35		ZFS_LINUX_TEST_RESULT([stack_frame_non_standard], [
36			AC_MSG_RESULT(yes)
37			AC_DEFINE(HAVE_STACK_FRAME_NON_STANDARD, 1,
38			   [STACK_FRAME_NON_STANDARD is defined])
39		],[
40			AC_MSG_RESULT(no)
41		])
42	],[
43		AC_MSG_RESULT(no)
44	])
45])
46