From 78392885c9b08021c89649728053d31503d8a509 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 22 Jun 2018 09:10:42 +0200 Subject: [PATCH] bpo-30345: Add -g to LDFLAGS for LTO (GH-7709) (GH-7826) 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 0000000000..f8db09bdbc --- /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 986ab871bd..8c2a0ca546 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 338be3b9a6..f2cd11730b 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. -- 2.50.1