Skip to content

Commit 83e545e

Browse files
committed
Skip fPIC
1 parent cb1f583 commit 83e545e

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

cpython-unix/build-cpython.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,8 +649,19 @@ fi
649649
# We patched configure.ac above. Reflect those changes.
650650
autoconf
651651

652-
# Ensure `CFLAGS` are propagated to JIT compilation for 3.13+
653-
CFLAGS=$CFLAGS CPPFLAGS=$CFLAGS CFLAGS_JIT=$CFLAGS LDFLAGS=$LDFLAGS \
652+
# Ensure `CFLAGS` are propagated to JIT compilation for 3.13+ (note this variable has no effect on
653+
# 3.12 and earlier)
654+
CFLAGS_JIT="${CFLAGS}"
655+
656+
# In 3.14+, the JIT compiler on x86-64 Linux uses a model that conflicts with `-fPIC`, so strip it
657+
# from the flags. See:
658+
# - https://github.com/python/cpython/issues/135690
659+
# - https://github.com/python/cpython/pull/130097
660+
if [[ -n "${PYTHON_MEETS_MINIMUM_VERSION_314}" && "${TARGET_TRIPLE}" == x86_64-* ]]; then
661+
CFLAGS_JIT="${CFLAGS_JIT//-fPIC/}"
662+
fi
663+
664+
CFLAGS=$CFLAGS CPPFLAGS=$CFLAGS CFLAGS_JIT=$CFLAGS_JIT LDFLAGS=$LDFLAGS \
654665
./configure ${CONFIGURE_FLAGS}
655666

656667
# Supplement produced Makefile with our modifications.

0 commit comments

Comments
 (0)