xref: /freebsd/sys/contrib/openzfs/config/kernel-objtool.m4 (revision e2eeea75eb8b6dd50c1298067a0655880d186734)
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/ptrace.h>
10		#include <asm/frame.h>
11	],[
12		#if !defined(FRAME_BEGIN)
13		#error "FRAME_BEGIN is not defined"
14		#endif
15	])
16
17	dnl # 4.6 API added STACK_FRAME_NON_STANDARD macro
18	ZFS_LINUX_TEST_SRC([stack_frame_non_standard], [
19		#include <linux/frame.h>
20	],[
21		#if !defined(STACK_FRAME_NON_STANDARD)
22		#error "STACK_FRAME_NON_STANDARD is not defined."
23		#endif
24	])
25])
26
27AC_DEFUN([ZFS_AC_KERNEL_OBJTOOL], [
28	AC_MSG_CHECKING(
29	    [whether compile-time stack validation (objtool) is available])
30	ZFS_LINUX_TEST_RESULT([objtool], [
31		AC_MSG_RESULT(yes)
32		AC_DEFINE(HAVE_KERNEL_OBJTOOL, 1,
33		    [kernel does stack verification])
34
35		AC_MSG_CHECKING([whether STACK_FRAME_NON_STANDARD is defined])
36		ZFS_LINUX_TEST_RESULT([stack_frame_non_standard], [
37			AC_MSG_RESULT(yes)
38			AC_DEFINE(HAVE_STACK_FRAME_NON_STANDARD, 1,
39			   [STACK_FRAME_NON_STANDARD is defined])
40		],[
41			AC_MSG_RESULT(no)
42		])
43	],[
44		AC_MSG_RESULT(no)
45	])
46])
47