From 6d0c73ab908b6050423b865549b0b1b2502d3b01 Mon Sep 17 00:00:00 2001 From: Piotr Kubaj Date: Thu, 7 May 2026 13:10:47 +0000 Subject: [PATCH] gapstate.h: account for a large jmp_buf Fixes build on powerpc64le platform. --- src/gapstate.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gapstate.h b/src/gapstate.h index 16d74d2c8a..6dc2191cff 100644 --- a/src/gapstate.h +++ b/src/gapstate.h @@ -24,7 +24,11 @@ #include enum { - STATE_SLOTS_SIZE = 32768 - 1024, + // On some platforms (e.g., powerpc64), sizeof(jmp_buf) is much larger + // than ~200 bytes on x86_64/aarch64. Subtract the excess so that + // GAPState stays within the 32767-byte 16-bit signed offset limit. + GAP_JMP_BUF_EXTRA = (int)sizeof(jmp_buf) > 200 ? (int)sizeof(jmp_buf) - 200 : 0, + STATE_SLOTS_SIZE = 32768 - 1024 - GAP_JMP_BUF_EXTRA, }; typedef struct GAPState {