From: Victor Stinner Date: Tue, 19 Jun 2018 16:24:58 +0000 (+0200) Subject: bpo-30345: Add -g to LDFLAGS for LTO (GH-7709) X-Git-Tag: v3.8.0a1~1529 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=06fe77a84bd29d51506ab2ff703ae585a6121af2;p=thirdparty%2FPython%2Fcpython.git bpo-30345: Add -g to LDFLAGS for LTO (GH-7709) Add -g to LDFLAGS when compiling with LTO to get debug symbols. --- 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 000000000000..f8db09bdbc66 --- /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 5187c6ff2b95..d427703f8e86 100755 --- a/configure +++ b/configure @@ -6427,6 +6427,14 @@ 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 + CFLAGS="$CFLAGS $LTOFLAGS" LDFLAGS="$LDFLAGS $LTOFLAGS" fi diff --git a/configure.ac b/configure.ac index b13728e37d7b..b98ceb2b1427 100644 --- a/configure.ac +++ b/configure.ac @@ -1302,6 +1302,14 @@ 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 + CFLAGS="$CFLAGS $LTOFLAGS" LDFLAGS="$LDFLAGS $LTOFLAGS" fi