From de492cea530943c90ca0396f4822d7abcf2d0e41 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 20 Jun 2018 15:21:52 +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 00000000000000..f8db09bdbc6684 --- /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 4a047e69bda1fe..a75ca3a0f5c9f2 100755 --- a/configure +++ b/configure @@ -6481,6 +6481,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 diff --git a/configure.ac b/configure.ac index 913d5469d06e34..36625f7b82a343 100644 --- a/configure.ac +++ b/configure.ac @@ -1455,6 +1455,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