From 0da0d5ea10a00676f6b463d7c0a3533d088c7eba Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 20 Jun 2018 15:48:07 +0200 Subject: [PATCH] bpo-30345: Add -g to LDFLAGS for LTO (GH-7709) Add -g to LDFLAGS when compiling with LTO to get debug symbols. --- .../next/Build/2018-06-15-18-18-16.bpo-30345.j-xRE1.rst | 1 + configure | 7 +++++++ configure.ac | 7 +++++++ 3 files changed, 15 insertions(+) create mode 100644 Misc/NEWS.d/next/Build/2018-06-15-18-18-16.bpo-30345.j-xRE1.rst diff --git a/Misc/NEWS.d/next/Build/2018-06-15-18-18-16.bpo-30345.j-xRE1.rst b/Misc/NEWS.d/next/Build/2018-06-15-18-18-16.bpo-30345.j-xRE1.rst new file mode 100644 index 000000000000000..f8db09bdbc6684b --- /dev/null +++ b/Misc/NEWS.d/next/Build/2018-06-15-18-18-16.bpo-30345.j-xRE1.rst @@ -0,0 +1 @@ +Add -g to LDFLAGS when compiling with LTO to get debug symbols. diff --git a/configure b/configure index 986ab871bd53ec3..8c2a0ca5466614d 100755 --- a/configure +++ b/configure @@ -6618,6 +6618,13 @@ if test "$Py_LTO" = 'true' ; then esac ;; esac + + if test "$ac_cv_prog_cc_g" = "yes" + then + # bpo-30345: Add -g to LDFLAGS when compiling with LTO + # to get debug symbols. + LTOFLAGS="$LTOFLAGS -g" + fi fi # Enable PGO flags. diff --git a/configure.ac b/configure.ac index 338be3b9a6bd445..f2cd11730b69510 100644 --- a/configure.ac +++ b/configure.ac @@ -1347,6 +1347,13 @@ if test "$Py_LTO" = 'true' ; then esac ;; esac + + if test "$ac_cv_prog_cc_g" = "yes" + then + # bpo-30345: Add -g to LDFLAGS when compiling with LTO + # to get debug symbols. + LTOFLAGS="$LTOFLAGS -g" + fi fi # Enable PGO flags.