]> granicus.if.org Git - python/commitdiff
bpo-30345: Add -g to LDFLAGS for LTO (GH-7709)
authorVictor Stinner <vstinner@redhat.com>
Tue, 19 Jun 2018 16:24:58 +0000 (18:24 +0200)
committerGitHub <noreply@github.com>
Tue, 19 Jun 2018 16:24:58 +0000 (18:24 +0200)
Add -g to LDFLAGS when compiling with LTO to get debug symbols.

Misc/NEWS.d/next/Build/2018-06-15-18-18-16.bpo-30345.j-xRE1.rst [new file with mode: 0644]
configure
configure.ac

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 (file)
index 0000000..f8db09b
--- /dev/null
@@ -0,0 +1 @@
+Add -g to LDFLAGS when compiling with LTO to get debug symbols.
index 5187c6ff2b95d4568ead32e70b35cc25a83bec86..d427703f8e860a2445610ee00b4f647eda4d0027 100755 (executable)
--- 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
index b13728e37d7b1bde2622e5a4b662f8597c3f8996..b98ceb2b1427ebe710eb92333e020e1343b3a7bd 100644 (file)
@@ -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