summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-06-19 16:24:58 (GMT)
committerGitHub <noreply@github.com>2018-06-19 16:24:58 (GMT)
commit06fe77a84bd29d51506ab2ff703ae585a6121af2 (patch)
tree4ee6795aeb1826c12c39b6eba1f71e81abf5509a
parentc44d8e5db6fb9d3847c49e9c9718f2b4cf71f506 (diff)
downloadcpython-06fe77a84bd29d51506ab2ff703ae585a6121af2.zip
cpython-06fe77a84bd29d51506ab2ff703ae585a6121af2.tar.gz
cpython-06fe77a84bd29d51506ab2ff703ae585a6121af2.tar.bz2
bpo-30345: Add -g to LDFLAGS for LTO (GH-7709)
Add -g to LDFLAGS when compiling with LTO to get debug symbols.
-rw-r--r--Misc/NEWS.d/next/Build/2018-06-15-18-18-16.bpo-30345.j-xRE1.rst1
-rwxr-xr-xconfigure8
-rw-r--r--configure.ac8
3 files changed, 17 insertions, 0 deletions
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 0000000..f8db09b
--- /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 5187c6f..d427703 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 b13728e..b98ceb2 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