From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Fri, 22 Jun 2018 07:10:20 +0000 (-0700) Subject: bpo-30345: Add -g to LDFLAGS for LTO (GH-7709) (GH-7824) X-Git-Tag: v3.7.1rc1~389 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1bb9dd337ed5aa9eafc8e2ce017ceedf044145e3;p=python bpo-30345: Add -g to LDFLAGS for LTO (GH-7709) (GH-7824) Add -g to LDFLAGS when compiling with LTO to get debug symbols. (cherry picked from commit 06fe77a84bd29d51506ab2ff703ae585a6121af2) Co-authored-by: Victor Stinner --- 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 e0389649ae..3e52e60f91 100755 --- a/configure +++ b/configure @@ -6482,6 +6482,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 b5beb08574..3885786aab 100644 --- a/configure.ac +++ b/configure.ac @@ -1339,6 +1339,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