1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

Add a configure-time check for the existence of sigaltstack. It seems that some

systems provide a <signal.h> that doesn't declare it.

llvm-svn: 270278
This commit is contained in:
Richard Smith 2016-05-20 21:26:00 +00:00
parent d86d870067
commit 74e8540951
3 changed files with 10 additions and 2 deletions

View File

@ -157,6 +157,9 @@ if( HAVE_SETJMP_H )
check_symbol_exists(siglongjmp setjmp.h HAVE_SIGLONGJMP) check_symbol_exists(siglongjmp setjmp.h HAVE_SIGLONGJMP)
check_symbol_exists(sigsetjmp setjmp.h HAVE_SIGSETJMP) check_symbol_exists(sigsetjmp setjmp.h HAVE_SIGSETJMP)
endif() endif()
if( HAVE_SIGNAL_H )
check_symbol_exists(sigaltstack signal.h HAVE_SIGALTSTACK)
endif()
if( HAVE_SYS_UIO_H ) if( HAVE_SYS_UIO_H )
check_symbol_exists(writev sys/uio.h HAVE_WRITEV) check_symbol_exists(writev sys/uio.h HAVE_WRITEV)
endif() endif()

View File

@ -248,6 +248,9 @@
/* Define if you have the shl_load function. */ /* Define if you have the shl_load function. */
#undef HAVE_SHL_LOAD #undef HAVE_SHL_LOAD
/* Define to 1 if you have the `sigaltstack' function. */
#cmakedefine HAVE_SIGALTSTACK ${HAVE_SIGALTSTACK}
/* Define to 1 if you have the `siglongjmp' function. */ /* Define to 1 if you have the `siglongjmp' function. */
#cmakedefine HAVE_SIGLONGJMP ${HAVE_SIGLONGJMP} #cmakedefine HAVE_SIGLONGJMP ${HAVE_SIGLONGJMP}

View File

@ -28,8 +28,6 @@
# include <execinfo.h> // For backtrace(). # include <execinfo.h> // For backtrace().
#endif #endif
#if HAVE_SIGNAL_H #if HAVE_SIGNAL_H
// FIXME: We unconditionally use symbols from this header below. Do we really
// need a configure-time check for a POSIX-mandated header in lib/Support/Unix?
#include <signal.h> #include <signal.h>
#endif #endif
#if HAVE_SYS_STAT_H #if HAVE_SYS_STAT_H
@ -119,6 +117,7 @@ static void RegisterHandler(int Signal) {
++NumRegisteredSignals; ++NumRegisteredSignals;
} }
#if defined(HAVE_SIGALTSTACK)
// Hold onto the old alternate signal stack so that it's not reported as a leak. // Hold onto the old alternate signal stack so that it's not reported as a leak.
// We don't make any attempt to remove our alt signal stack if we remove our // We don't make any attempt to remove our alt signal stack if we remove our
// signal handlers; that can't be done reliably if someone else is also trying // signal handlers; that can't be done reliably if someone else is also trying
@ -143,6 +142,9 @@ static void CreateSigAltStack() {
if (sigaltstack(&AltStack, &OldAltStack) != 0) if (sigaltstack(&AltStack, &OldAltStack) != 0)
free(AltStack.ss_sp); free(AltStack.ss_sp);
} }
#else
static void CreateSigAltStack() {}
#endif
static void RegisterHandlers() { static void RegisterHandlers() {
// We need to dereference the signals mutex during handler registration so // We need to dereference the signals mutex during handler registration so