@@ -2490,6 +2490,19 @@ then
24902490fi
24912491
24922492AS_VAR_IF ( [ ac_cv_gcc_compat] , [ yes] , [
2493+ dnl Keep frame pointers in CPython and stdlib objects so native profilers
2494+ dnl can unwind interpreter frames and generated trampolines without DWARF.
2495+ frame_pointer_cflags=
2496+ AX_CHECK_COMPILE_FLAG ( [ -fno-omit-frame-pointer] , [
2497+ frame_pointer_cflags="-fno-omit-frame-pointer"
2498+ AX_CHECK_COMPILE_FLAG ( [ -mno-omit-leaf-frame-pointer] , [
2499+ frame_pointer_cflags="$frame_pointer_cflags -mno-omit-leaf-frame-pointer"
2500+ ] , [ ] , [ -Werror] )
2501+ ] , [ ] , [ -Werror] )
2502+ if test -n "$frame_pointer_cflags"; then
2503+ CFLAGS_NODIST="$frame_pointer_cflags $CFLAGS_NODIST"
2504+ fi
2505+
24932506 CFLAGS_NODIST="$CFLAGS_NODIST -std=c11"
24942507
24952508 PY_CHECK_CC_WARNING([ enable] , [ extra] , [ if we can add -Wextra] )
@@ -3748,11 +3761,6 @@ AC_MSG_RESULT([$perf_trampoline])
37483761AS_VAR_IF ( [ perf_trampoline] , [ yes] , [
37493762 AC_DEFINE ( [ PY_HAVE_PERF_TRAMPOLINE] , [ 1] , [ Define to 1 if you have the perf trampoline.] )
37503763 PERF_TRAMPOLINE_OBJ=Python/asm_trampoline.o
3751-
3752- dnl perf needs frame pointers for unwinding, include compiler option in debug builds
3753- AS_VAR_IF ( [ Py_DEBUG] , [ true] , [
3754- AS_VAR_APPEND ( [ BASECFLAGS] , [ " -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"] )
3755- ] )
37563764] )
37573765AC_SUBST ( [ PERF_TRAMPOLINE_OBJ] )
37583766
0 commit comments