The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/contrib/libsodium/m4/ax_check_catchable_segv.m4

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 # SYNOPSIS
    2 #
    3 #   AX_CHECK_CATCHABLE_SEGV
    4 #
    5 # DESCRIPTION
    6 #
    7 #  Check whether segmentation violations can be caught using signal handlers.
    8 
    9 #serial 1
   10 
   11 AC_DEFUN([AX_CHECK_CATCHABLE_SEGV], [dnl
   12     AC_PREREQ(2.64)
   13     AS_VAR_PUSHDEF([CACHEVAR], [ax_cv_check_[]_AC_LANG_ABBREV[]CATCHABLE_SEGV])dnl
   14     AC_CACHE_CHECK([whether segmentation violations can be caught when using the _AC_LANG compiler], CACHEVAR, [
   15         AC_RUN_IFELSE([
   16             AC_LANG_PROGRAM([[
   17 #include <signal.h>
   18 #include <stdlib.h>
   19 static void sig(int _) { exit(0); }
   20             ]], [[
   21 volatile unsigned char * volatile x = (volatile unsigned char *) malloc(8);
   22 size_t i;
   23 
   24 signal(SIGSEGV, sig);
   25 signal(SIGBUS, sig);
   26 #if !defined(__SANITIZE_ADDRESS__) && !defined(__EMSCRIPTEN__)
   27 for (i = 0; i < 10000000; i += 1024) { x[-i] = x[i] = (unsigned char) i; }
   28 #endif
   29 free((void *) x);
   30 exit(1)
   31             ]])],
   32             [AS_VAR_SET(CACHEVAR, [yes])],
   33             [AS_VAR_SET(CACHEVAR, [no])],
   34             [AS_VAR_SET(CACHEVAR, [unknown])]
   35         )
   36     ])
   37     AS_VAR_IF(CACHEVAR, yes,
   38         [AC_DEFINE([HAVE_CATCHABLE_SEGV], [1], [Define if segmentation violations can be caught using signal handlers])],
   39         [AC_MSG_WARN([On this platform, segmentation violations cannot be caught using signal handlers. This is expected if you enabled a tool such as Address Sanitizer (-fsanitize=address), but be aware that using Address Sanitizer may also significantly reduce performance.])]
   40     )
   41     AS_VAR_POPDEF([CACHEVAR])dnl
   42 ])

Cache object: 39ce4e1fdcdad1070227f7432012b3f1


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.