Configure: Add configure switch to control use of sigaltstack
This commit is contained in:
48
config.lib
48
config.lib
@@ -99,6 +99,7 @@ set_default() {
|
|||||||
with_bfd_extra_debug="1"
|
with_bfd_extra_debug="1"
|
||||||
with_self_gdb_debug="1"
|
with_self_gdb_debug="1"
|
||||||
with_self_lldb_debug="1"
|
with_self_lldb_debug="1"
|
||||||
|
with_sigaltstack="1"
|
||||||
|
|
||||||
save_params_array="
|
save_params_array="
|
||||||
build
|
build
|
||||||
@@ -180,6 +181,7 @@ set_default() {
|
|||||||
with_bfd_extra_debug
|
with_bfd_extra_debug
|
||||||
with_self_gdb_debug
|
with_self_gdb_debug
|
||||||
with_self_lldb_debug
|
with_self_lldb_debug
|
||||||
|
with_sigaltstack
|
||||||
CC CXX CFLAGS CXXFLAGS LDFLAGS CFLAGS_BUILD CXXFLAGS_BUILD LDFLAGS_BUILD PKG_CONFIG_PATH PKG_CONFIG_LIBDIR"
|
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="1";;
|
||||||
--with-self-lldb-debug=*) with_self_lldb_debug="$optarg";;
|
--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";;
|
CC=* | --CC=*) CC="$optarg";;
|
||||||
CXX=* | --CXX=*) CXX="$optarg";;
|
CXX=* | --CXX=*) CXX="$optarg";;
|
||||||
CFLAGS=* | --CFLAGS=*) CFLAGS="$optarg";;
|
CFLAGS=* | --CFLAGS=*) CFLAGS="$optarg";;
|
||||||
@@ -1817,27 +1823,31 @@ EOL
|
|||||||
CFLAGS="$CFLAGS -DWITH_UCONTEXT"
|
CFLAGS="$CFLAGS -DWITH_UCONTEXT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log 2 "executing $cc_host $CFLAGS $CFLAGS_ENV $LDFLAGS $LDFLAGS_ENV $STATIC_FLAGS -o tmp.config.sigaltstack -x c++ - -ldl"
|
if [ "$with_sigaltstack" = "1" ]; then
|
||||||
"$cc_host" $CFLAGS $CFLAGS_ENV $LDFLAGS $LDFLAGS_ENV $STATIC_FLAGS -o tmp.config.sigaltstack -x c++ - -ldl 2> /dev/null << EOL
|
log 2 "executing $cc_host $CFLAGS $CFLAGS_ENV $LDFLAGS $LDFLAGS_ENV $STATIC_FLAGS -o tmp.config.sigaltstack -x c++ - -ldl"
|
||||||
#include <signal.h>
|
"$cc_host" $CFLAGS $CFLAGS_ENV $LDFLAGS $LDFLAGS_ENV $STATIC_FLAGS -o tmp.config.sigaltstack -x c++ - -ldl 2> /dev/null << EOL
|
||||||
#include <stdlib.h>
|
#include <signal.h>
|
||||||
int main() {
|
#include <stdlib.h>
|
||||||
stack_t ss;
|
int main() {
|
||||||
ss.ss_sp = calloc(SIGSTKSZ, 1);
|
stack_t ss;
|
||||||
ss.ss_size = SIGSTKSZ;
|
ss.ss_sp = calloc(SIGSTKSZ, 1);
|
||||||
ss.ss_flags = 0;
|
ss.ss_size = SIGSTKSZ;
|
||||||
sigaltstack(&ss, nullptr);
|
ss.ss_flags = 0;
|
||||||
return 0;
|
sigaltstack(&ss, nullptr);
|
||||||
}
|
return 0;
|
||||||
|
}
|
||||||
EOL
|
EOL
|
||||||
ret=$?
|
ret=$?
|
||||||
rm -f tmp.config.sigaltstack
|
rm -f tmp.config.sigaltstack
|
||||||
log 2 " exit code $ret"
|
log 2 " exit code $ret"
|
||||||
if [ $ret -ne 0 ]; then
|
if [ $ret -ne 0 ]; then
|
||||||
log 1 "checking sigaltstack... no"
|
log 1 "checking sigaltstack... no"
|
||||||
|
else
|
||||||
|
log 1 "checking sigaltstack... found"
|
||||||
|
CFLAGS="$CFLAGS -DWITH_SIGALTSTACK"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
log 1 "checking sigaltstack... found"
|
log 1 "checking sigaltstack... disabled"
|
||||||
CFLAGS="$CFLAGS -DWITH_SIGALTSTACK"
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user