llvm.org GIT mirror llvm / b074e28
Add a configure-time check for the existence of sigaltstack. It seems that some systems provide a <signal.h> that doesn't declare it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270278 91177308-0d34-0410-b5e6-96231b3b80d8 Richard Smith 4 years ago
3 changed file(s) with 10 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
155155 check_symbol_exists(setjmp setjmp.h HAVE_SETJMP)
156156 check_symbol_exists(siglongjmp setjmp.h HAVE_SIGLONGJMP)
157157 check_symbol_exists(sigsetjmp setjmp.h HAVE_SIGSETJMP)
158 endif()
159 if( HAVE_SIGNAL_H )
160 check_symbol_exists(sigaltstack signal.h HAVE_SIGALTSTACK)
158161 endif()
159162 if( HAVE_SYS_UIO_H )
160163 check_symbol_exists(writev sys/uio.h HAVE_WRITEV)
246246
247247 /* Define if you have the shl_load function. */
248248 #undef HAVE_SHL_LOAD
249
250 /* Define to 1 if you have the `sigaltstack' function. */
251 #cmakedefine HAVE_SIGALTSTACK ${HAVE_SIGALTSTACK}
249252
250253 /* Define to 1 if you have the `siglongjmp' function. */
251254 #cmakedefine HAVE_SIGLONGJMP ${HAVE_SIGLONGJMP}
2727 # include // For backtrace().
2828 #endif
2929 #if HAVE_SIGNAL_H
30 // FIXME: We unconditionally use symbols from this header below. Do we really
31 // need a configure-time check for a POSIX-mandated header in lib/Support/Unix?
3230 #include
3331 #endif
3432 #if HAVE_SYS_STAT_H
118116 ++NumRegisteredSignals;
119117 }
120118
119 #if defined(HAVE_SIGALTSTACK)
121120 // Hold onto the old alternate signal stack so that it's not reported as a leak.
122121 // We don't make any attempt to remove our alt signal stack if we remove our
123122 // signal handlers; that can't be done reliably if someone else is also trying
142141 if (sigaltstack(&AltStack, &OldAltStack) != 0)
143142 free(AltStack.ss_sp);
144143 }
144 #else
145 static void CreateSigAltStack() {}
146 #endif
145147
146148 static void RegisterHandlers() {
147149 // We need to dereference the signals mutex during handler registration so