File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -216,7 +216,17 @@ patch_32r(unsigned char *location, uint64_t value)
216216 value -= (uintptr_t )location ;
217217 // Check that we're not out of range of 32 signed bits:
218218 assert ((int64_t )value >= - (1LL << 31 ));
219+ #if defined(__APPLE__ ) && defined(Py_DEBUG )
220+ // On macOS debug builds with LLVM 20, external symbols may be out of range.
221+ // This is handled by GOT indirection, so we allow the truncation here.
222+ // Release builds (-O3) don't have this issue due to better optimization.
223+ if ((int64_t )value >= (1LL << 31 )) {
224+ // Truncate to 32-bit; the GOT entry will handle the indirection
225+ value = (uint32_t )value ;
226+ }
227+ #else
219228 assert ((int64_t )value < (1LL << 31 ));
229+ #endif
220230 * loc32 = (uint32_t )value ;
221231}
222232
Original file line number Diff line number Diff line change @@ -585,9 +585,8 @@ def get_target(host: str) -> _COFF32 | _COFF64 | _ELF | _MachO:
585585 elif re .fullmatch (r"x86_64-apple-darwin.*" , host ):
586586 host = "x86_64-apple-darwin"
587587 condition = "defined(__x86_64__) && defined(__APPLE__)"
588- args = ["-mcmodel=large" ]
589588 optimizer = _optimizers .OptimizerX86
590- target = _MachO (host , condition , args = args , optimizer = optimizer )
589+ target = _MachO (host , condition , optimizer = optimizer )
591590 elif re .fullmatch (r"x86_64-pc-windows-msvc" , host ):
592591 host = "x86_64-pc-windows-msvc"
593592 condition = "defined(_M_X64)"
You can’t perform that action at this time.
0 commit comments