Skip to content

Commit 1bb9dd3

Browse files
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 06fe77a) Co-authored-by: Victor Stinner <[email protected]>
1 parent d554414 commit 1bb9dd3

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add -g to LDFLAGS when compiling with LTO to get debug symbols.

configure

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6482,6 +6482,14 @@ if test "$Py_LTO" = 'true' ; then
64826482
esac
64836483
;;
64846484
esac
6485+
6486+
if test "$ac_cv_prog_cc_g" = "yes"
6487+
then
6488+
# bpo-30345: Add -g to LDFLAGS when compiling with LTO
6489+
# to get debug symbols.
6490+
LTOFLAGS="$LTOFLAGS -g"
6491+
fi
6492+
64856493
CFLAGS="$CFLAGS $LTOFLAGS"
64866494
LDFLAGS="$LDFLAGS $LTOFLAGS"
64876495
fi

configure.ac

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,6 +1339,14 @@ if test "$Py_LTO" = 'true' ; then
13391339
esac
13401340
;;
13411341
esac
1342+
1343+
if test "$ac_cv_prog_cc_g" = "yes"
1344+
then
1345+
# bpo-30345: Add -g to LDFLAGS when compiling with LTO
1346+
# to get debug symbols.
1347+
LTOFLAGS="$LTOFLAGS -g"
1348+
fi
1349+
13421350
CFLAGS="$CFLAGS $LTOFLAGS"
13431351
LDFLAGS="$LDFLAGS $LTOFLAGS"
13441352
fi

0 commit comments

Comments
 (0)