Configure: Add configure switch to control use of sigaltstack

This commit is contained in:
Jonathan G Rennison
2019-11-05 17:59:11 +00:00
parent a7404a88bd
commit 7046327b67

View File

@@ -99,6 +99,7 @@ set_default() {
with_bfd_extra_debug="1"
with_self_gdb_debug="1"
with_self_lldb_debug="1"
with_sigaltstack="1"
save_params_array="
build
@@ -180,6 +181,7 @@ set_default() {
with_bfd_extra_debug
with_self_gdb_debug
with_self_lldb_debug
with_sigaltstack
CC CXX CFLAGS CXXFLAGS LDFLAGS CFLAGS_BUILD CXXFLAGS_BUILD LDFLAGS_BUILD PKG_CONFIG_PATH PKG_CONFIG_LIBDIR"
}
@@ -491,6 +493,10 @@ detect_params() {
--with-self-lldb-debug) with_self_lldb_debug="1";;
--with-self-lldb-debug=*) with_self_lldb_debug="$optarg";;
--without-sigaltstack) with_sigaltstack="0";;
--with-sigaltstack) with_sigaltstack="1";;
--with-sigaltstack=*) with_sigaltstack="$optarg";;
CC=* | --CC=*) CC="$optarg";;
CXX=* | --CXX=*) CXX="$optarg";;
CFLAGS=* | --CFLAGS=*) CFLAGS="$optarg";;
@@ -1817,27 +1823,31 @@ EOL
CFLAGS="$CFLAGS -DWITH_UCONTEXT"
fi
log 2 "executing $cc_host $CFLAGS $CFLAGS_ENV $LDFLAGS $LDFLAGS_ENV $STATIC_FLAGS -o tmp.config.sigaltstack -x c++ - -ldl"
"$cc_host" $CFLAGS $CFLAGS_ENV $LDFLAGS $LDFLAGS_ENV $STATIC_FLAGS -o tmp.config.sigaltstack -x c++ - -ldl 2> /dev/null << EOL
#include <signal.h>
#include <stdlib.h>
int main() {
stack_t ss;
ss.ss_sp = calloc(SIGSTKSZ, 1);
ss.ss_size = SIGSTKSZ;
ss.ss_flags = 0;
sigaltstack(&ss, nullptr);
return 0;
}
if [ "$with_sigaltstack" = "1" ]; then
log 2 "executing $cc_host $CFLAGS $CFLAGS_ENV $LDFLAGS $LDFLAGS_ENV $STATIC_FLAGS -o tmp.config.sigaltstack -x c++ - -ldl"
"$cc_host" $CFLAGS $CFLAGS_ENV $LDFLAGS $LDFLAGS_ENV $STATIC_FLAGS -o tmp.config.sigaltstack -x c++ - -ldl 2> /dev/null << EOL
#include <signal.h>
#include <stdlib.h>
int main() {
stack_t ss;
ss.ss_sp = calloc(SIGSTKSZ, 1);
ss.ss_size = SIGSTKSZ;
ss.ss_flags = 0;
sigaltstack(&ss, nullptr);
return 0;
}
EOL
ret=$?
rm -f tmp.config.sigaltstack
log 2 " exit code $ret"
if [ $ret -ne 0 ]; then
log 1 "checking sigaltstack... no"
ret=$?
rm -f tmp.config.sigaltstack
log 2 " exit code $ret"
if [ $ret -ne 0 ]; then
log 1 "checking sigaltstack... no"
else
log 1 "checking sigaltstack... found"
CFLAGS="$CFLAGS -DWITH_SIGALTSTACK"
fi
else
log 1 "checking sigaltstack... found"
CFLAGS="$CFLAGS -DWITH_SIGALTSTACK"
log 1 "checking sigaltstack... disabled"
fi
fi