File tree Expand file tree Collapse file tree 4 files changed +12
-8
lines changed Expand file tree Collapse file tree 4 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,8 @@ option(S2N_INTERN_LIBCRYPTO "This ensures that s2n-tls is compiled and deployed
2727version of libcrypto by interning the code and hiding symbols. This also enables s2n-tls to be
2828loaded in an application with an otherwise conflicting libcrypto version." OFF )
2929option (S2N_LTO, "Enables link time optimizations when building s2n-tls." OFF )
30+ option (S2N_STACKTRACE "Enables stacktrace functionality in s2n-tls." ON )
31+
3032# Turn BUILD_TESTING=ON by default
3133include (CTest)
3234
@@ -434,8 +436,10 @@ if(ADX_SUPPORTED)
434436 message (STATUS "Support for ADX assembly instructions detected" )
435437endif ()
436438
437- if (S2N_HAVE_EXECINFO)
438- target_compile_options (${PROJECT_NAME} PUBLIC -DS2N_HAVE_EXECINFO)
439+ if (S2N_HAVE_EXECINFO AND S2N_STACKTRACE)
440+ target_compile_options (${PROJECT_NAME} PUBLIC -DS2N_STACKTRACE)
441+ else ()
442+ message (STATUS "Disabling stacktrace functionality" )
439443endif ()
440444
441445if (S2N_CPUID_AVAILABLE)
Original file line number Diff line number Diff line change 2424#include "utils/s2n_map.h"
2525#include "utils/s2n_safety.h"
2626
27- #if S2N_HAVE_EXECINFO
27+ #ifdef S2N_STACKTRACE
2828# include <execinfo.h>
2929#endif
3030
@@ -367,7 +367,7 @@ int s2n_stack_traces_enabled_set(bool newval)
367367 return S2N_SUCCESS ;
368368}
369369
370- #ifdef S2N_HAVE_EXECINFO
370+ #ifdef S2N_STACKTRACE
371371
372372#define MAX_BACKTRACE_DEPTH 20
373373__thread struct s2n_stacktrace tl_stacktrace = {0 };
@@ -418,7 +418,7 @@ int s2n_print_stacktrace(FILE *fptr)
418418 return S2N_SUCCESS ;
419419}
420420
421- #else /* !S2N_HAVE_EXECINFO */
421+ #else /* !S2N_STACKTRACE */
422422int s2n_free_stacktrace (void )
423423{
424424 S2N_ERROR (S2N_ERR_UNIMPLEMENTED );
@@ -443,4 +443,4 @@ int s2n_print_stacktrace(FILE *fptr)
443443{
444444 S2N_ERROR (S2N_ERR_UNIMPLEMENTED );
445445}
446- #endif /* S2N_HAVE_EXECINFO */
446+ #endif /* S2N_STACKTRACE */
Original file line number Diff line number Diff line change @@ -186,7 +186,7 @@ try_compile = $(shell $(CC) $(CFLAGS) -c -o tmp.o $(1) > /dev/null 2>&1; echo $$
186186# Determine if execinfo.h is available
187187TRY_COMPILE_EXECINFO := $(call try_compile,$(S2N_ROOT ) /tests/features/execinfo.c)
188188ifeq ($(TRY_COMPILE_EXECINFO ) , 0)
189- DEFAULT_CFLAGS += -DS2N_HAVE_EXECINFO
189+ DEFAULT_CFLAGS += -DS2N_STACKTRACE
190190endif
191191
192192# Determine if cpuid.h is available
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ int main(int argc, char **argv)
2828{
2929 BEGIN_TEST ();
3030 EXPECT_SUCCESS (s2n_disable_tls13_in_test ());
31- #ifdef S2N_HAVE_EXECINFO
31+ #ifdef S2N_STACKTRACE
3232 EXPECT_SUCCESS (s2n_stack_traces_enabled_set (true));
3333 struct s2n_stacktrace trace ;
3434 /* If nothing has errored yet, we have no stacktrace */
You can’t perform that action at this time.
0 commit comments