Skip to content

Commit ca45fc4

Browse files
committed
On macOS, add 64 bytes of headerpad to accommodate code signatures
Closes #749.
1 parent 803b401 commit ca45fc4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

cpython-unix/build-cpython.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,16 @@ if [[ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_12}" && "${TARGET_TRIPLE}" = "ppc64le
365365
LDFLAGS="${LDFLAGS} -Wl,--no-tls-get-addr-optimize"
366366
fi
367367

368+
# We're calling install_name_tool -add_rpath on extension modules, which
369+
# eats up 0x20 bytes of space in the Mach-O header, and we need to make
370+
# sure there's still enough room to add a code signature (0x10 bytes) on
371+
# non-arm64 where there's no automatic ad-hoc signature. We are somehow
372+
# on a toolchain that doesn't make sure there's enough space by default
373+
# so give it plenty of space.
374+
if [[ "${PYBUILD_PLATFORM}" = macos* ]]; then
375+
LDFLAGS="${LDFLAGS} -Wl,-headerpad,40"
376+
fi
377+
368378
CPPFLAGS=$CFLAGS
369379

370380
CONFIGURE_FLAGS="

0 commit comments

Comments
 (0)