Skip to content

Commit 0b479df

Browse files
authored
remove -use-gnu-stack from BOLT flags (#1065)
Remove -use-gnu-stack from the BOLT flags used to optimize CPython as it incorrectly removes the PT_GNU_STACK segment causing glibc to default to an executable stack, for example when creating a new thread. This can be reverted when llvm/llvm-project#174191 is fixed in LLVM Should be applied after #1064 closes #956
1 parent 5bf3a6f commit 0b479df

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

cpython-unix/build-cpython.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,12 @@ if [ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_12}" ]; then
257257
else
258258
patch -p1 -i "${ROOT}/patch-configure-bolt-skip-funcs.patch"
259259
fi
260+
261+
# Remove -use-gnu-stack from the BOLT optimization flags as it incorrectly
262+
# removes the PT_GNU_STACK segment. This patch can be removed when this bug
263+
# is fixed in LLVM.
264+
# https://github.com/llvm/llvm-project/issues/174191
265+
patch -p1 -i "${ROOT}/patch-configure-bolt-remove-use-gnu-stack.patch"
260266
fi
261267

262268
# The optimization make targets are both phony and non-phony. This leads
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
diff --git a/configure.ac b/configure.ac
2+
index a1f4a567095..03264f87d4c 100644
3+
--- a/configure.ac
4+
+++ b/configure.ac
5+
@@ -2205,7 +2205,6 @@ then
6+
-inline-ap
7+
-indirect-call-promotion=all
8+
-dyno-stats
9+
- -use-gnu-stack
10+
-frame-opt=hot
11+
")]
12+
)

0 commit comments

Comments
 (0)