Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CB109606A322 for ; Wed, 2 Dec 2026 20:33:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=J4/Y+bG1; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=Z6+0ewK6 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xYr1B-0007w1-NH; Wed, 02 Dec 2026 15:33:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xYr19-0007vW-SL for qemu-devel@nongnu.org; Wed, 02 Dec 2026 15:33:31 -0500 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xYr17-0008QM-Tz for qemu-devel@nongnu.org; Wed, 02 Dec 2026 15:33:31 -0500 Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B2Iu39D1125421 for ; Wed, 2 Dec 2026 20:33:28 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 3rQJcF0QUiSCL3lpQcFFw2abOYEaeBSuamW+nRP89Lo=; b=J4/Y+bG1D7KKoUD3 Qc4ylEzmprHtWWCm+t+6a3CMiikXoZfi7CaKXr2Ip6DmXMf62US5Y+E+U1QM2aBV ZncvyS5IsXTYqUMT0ZemuCJ8NvEGANE9H05uZhktJtsbTIyLJ9hCUBz/YGXvxmjF dy4EDr4VG79vjYLJI3bcxY9x12u+xjXDqJ7qtvJvR6gL1n1rpPWXR6vkelQL2jaV IHxlIA+paeMhVCAUNTQntF/lJwFZRRB8pKFIgBPiYNZKFHuyXB8fo97d6IWjz/WX yRSc79qOnFIHjT1hid0YE1oQDkyKZmi4wSCTOoAUuytR+5aqNz1E5l1xe1nFRxw9 AwLE5Q== Received: from mail-dy1-f198.google.com (mail-dy1-f198.google.com [74.125.82.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4jamyp9hrv-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 02 Dec 2026 20:33:28 +0000 (GMT) Received: by mail-dy1-f198.google.com with SMTP id 5a478bee46e88-3869accaac2so176735eec.1 for ; Wed, 02 Dec 2026 12:33:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1796243607; x=1796848407; darn=nongnu.org; h=content-transfer-encoding:content-type:in-reply-to:content-language :references:to:from:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to:content-type; bh=3rQJcF0QUiSCL3lpQcFFw2abOYEaeBSuamW+nRP89Lo=; b=Z6+0ewK6dzrJb/Am7i7IKg9Xh1wPQzxrl0pmCFzJj5+/nf+GuR8dpp3bWpHAWW6T90 RPUUafLaFKRRX3v95oaGvXYsB26ZGx5znKhT6yEZyDWQbKkZghqGfmElTVk0/GOlrgu9 kR4yDcDLRE+Eo6qNMjK/NOuxpTICKnl1utZ5ST64WhONKMuCyBh1YNmhl7LH8MvGEcj0 9vb44R4gyg+D9a90F3jur4RjezwT6efEWNltm6bJVcJvkOiYjHedIvv5dgfsGDIY/1Ln E2ePlMBwao9P9BbQqam2MezfyiYZt9Tje3xb0i5uyNqBfcU67PcehuMelEhLrWx5/tg8 624w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796243607; x=1796848407; h=content-transfer-encoding:content-type:in-reply-to:content-language :references:to:from:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=3rQJcF0QUiSCL3lpQcFFw2abOYEaeBSuamW+nRP89Lo=; b=O2Iub07w7RCUIY5Krx/0c7yja+rCTN4YuWKVP6/HapmYFSA0HvSJf+Z/cfLE73DqgY sFFaaX2K6GQ0fR6+XO45K6kwfhtmqvzH8c1pTSpHZtfdxyBj1Sh900w0Ookm8vW6PsHW zOKQZlxxFHhFYP4ENutgDwS3k1X2pxwzWEukLP3PyzDd3nmAxlFlfLvPKmKF7OEx/HBR 5eO2NeYq2DU7qduv3R5obDY3dNM5MWoexFUY/T5fy90u2AuGAiF+UGtZ2z6aIdD7B35F RGMCYxHV1s+ovaK+NufLa9NhXWLgYwg+Qx0SvT6jG4ZNpHuBcvSEiSskaGTZJubncDhw AVAg== X-Forwarded-Encrypted: i=1; AL+hErHhYAPPyL48AX/wnSwdVATKl1vZlKpnWRShFHDYbQFCAFSEFpgaeagC1bUmxXZpannDxuuLiiQHs1Dq@nongnu.org X-Gm-Message-State: APuU4Z/Jfym45UPqlmc7A7+9x3WDR8+4HvLpr+Y0QQZT58wNJiCa5bDN beAi7//vS5aDpnXudtkx9aEgnQ2OqpGRmJ/RAe6wYE4e6XIjoL4abiEOIkNnDhFb5mtTgmcZsXz EmCq+bIiBe9dgcEwGnWpBnGTtWAofjlS5AfIr5qu+o4wxPmnhLi5gDhbDOg== X-Gm-Gg: AZFdTZdxpe+THiEkRh6JO6vE0iGJnRu1sQCpyhYClmwqULzVKJhwVks/5RdowxjBgFw fncik3VoaeFN6qeuRdnTHtzmfbhNRtPEbaTNTtk9boouR5SxRDS4i4qEZtAYZvRZOe+RuOLmxQF fztXh6wqmmRJ7scIFZuDC5BXvn/RL+hdsFac2FnUr91oHqA06BGGC6ahRqcSpm536fKRMrM8S3u hJ3OT0Xrs4pZDQl0v1M0BF2AUc/DXAZjqnCm1GXwav3vIZU0dsB7MSqc/60kz0xradvwf/GNOPQ RCnbyZ5n0L7/vfOvB1SMT6HPjqwNXylpZhNsResa0KCENKr38yg81wyksMRm0Fk8c+bXH/K/L4b dmUz9eGg1OmoAPqGzz+5ecmqanNZIojIAWwYiE1M4wo/ZuqBnh4iXEH7WQCaO3LCnrEO1RXZVYE +uuGv8ktPB23H3SumtMoo4kM993+aIBi+ujw6/o5RJLQ== X-Received: by 2002:a05:7300:51d4:b0:384:fef7:5876 with SMTP id 5a478bee46e88-384fef75c78mr45877819eec.24.1796243607112; Wed, 02 Dec 2026 12:33:27 -0800 (PST) X-Received: by 2002:a05:7300:51d4:b0:384:fef7:5876 with SMTP id 5a478bee46e88-384fef75c78mr45877784eec.24.1796243606342; Wed, 02 Dec 2026 12:33:26 -0800 (PST) Received: from [192.168.1.199] (192-80-163-190.dyn.novuscom.net. [192.80.163.190]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-385f68bc0adsm116271268eec.13.2026.12.02.12.33.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Dec 2026 12:33:25 -0800 (PST) Message-ID: <6b417d59-bc75-4cca-9b47-99f009d4a7f5@oss.qualcomm.com> Date: Wed, 2 Dec 2026 12:33:24 -0800 X-Archived-By: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PULL 1/1] meson.build: windows-arm64 build fix, use _setjmpex instead of (removed) __mingw_setjmp From: Pierrick Bouvier To: Richard Henderson , qemu-devel@nongnu.org, peter.maydell@linaro.org, pbonzini@redhat.com, stefanha@redhat.com References: <20261202004603.2002932-1-pierrick.bouvier@oss.qualcomm.com> <20261202004603.2002932-2-pierrick.bouvier@oss.qualcomm.com> <697571d6-8dbf-4a82-aad8-c88e963ba3bb@linaro.org> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAyMDA4MSBTYWx0ZWRfXxBkBwCKiZRry LSdAL9Xh/qRdu2EzdO73NrIoZ3ie6ZPwclYsDXrL++OamJj0oJxybIrsu1LKXeXwbGPOYe0kuah FQ1OnlRurp/0jUZZolM1j9lqReBmT0g= X-Proofpoint-GUID: YmJVYAorLmFL6W0hcMwe52qlb2cs0TSL X-Authority-Analysis: v=2.4 cv=U/8Hnuru c=1 sm=1 tr=0 ts=6b108098 cx=c_pps a=wEP8DlPgTf/vqF+yE6f9lg==:117 a=9852oil1ID9t5xBSyQ/BEA==:17 a=IkcTkHD0fZMA:10 a=pUM-KoujPXoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=NEAV23lmAAAA:8 a=p0WdMEafAAAA:8 a=VwQbUJbxAAAA:8 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=vLf_6rIgYfo5VPC6tawA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=bBxd6f-gb0O0v-kibOvt:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-ORIG-GUID: YmJVYAorLmFL6W0hcMwe52qlb2cs0TSL X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAyMDA4MSBTYWx0ZWRfX67134/LqcDss HDCFA/M9Yj77SXoJms5XK0fJ1RGno8+R8vzTB62/WIhXxaaWqpePfGexW+DnMglJr68VAOsOFN0 QwI1cRzOqsNzkhxh46tSswuR24VRyEtYcK24Nv5VFQ+8IvpV3tFEjN5llQNjzswqwxBYX5f9QE6 5MsDm+FKFX/blsY750nK9qFI+QHbVWjgoEbgwF6u75DL0wxgKkamS60s+/9yt1FunB/dXFVTJia 09DMMZcvb7zb6+x7VJ2PORPItC6zfn26uZrtV7mAjyXQZPPWMoWLZvKZ/q3dPcc37cxGe6F+uD3 g4IewDh1/1W1dOcLjf5uzcIPzGvJDmsSXROtl+i2izIICxQxUZNrLKZmpHqCrx4DaYUgpBmkB13 972z+iVcJEctYIO9xD1E5gK57D5ok35375PtPieJElp2hXiMOOB+SuHLYhPtLIrxvCLbwaCLywb an7NwkP1VuBQ9xL8BiA== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-12-02_05,2026-12-02_07,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 priorityscore=1501 adultscore=0 spamscore=0 phishscore=0 clxscore=1015 malwarescore=0 bulkscore=0 lowpriorityscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612020081 Received-SPF: pass client-ip=205.220.180.131; envelope-from=pierrick.bouvier@oss.qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org X-Spam-Status: No, score=-22.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_PASS,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On 12/2/2026 12:29 PM, Pierrick Bouvier wrote: > On 12/2/2026 12:21 PM, Richard Henderson wrote: >> On 12/1/26 16:46, Pierrick Bouvier wrote: >>> mingw-w64 removed __mingw_setjmp for aarch64, as its usage was >>> replaced by _setjmpex, which has the same functionality: >>> https://github.com/mingw-w64/mingw-w64/ >>> commit/326b51ef75c4dde099edb063a573b7d114a93af1 >>> >>> This change reached MSYS2 with toolchain update a few days ago, >>> mingw-w64-clang-aarch64-crt14.0.0.r757.g7dceb7d77, and configure now >>> fails on windows-arm64: >>> >>>    ld.lld: error: undefined symbol: __mingw_setjmp >>>    ../meson.build:3226:4: ERROR: Problem encountered: mingw must provide >>>    setjmp/longjmp for windows-arm64 >>> >>> _setjmpex is provided by the Windows CRT, so this works with >>> both older and newer mingw-w64 versions. >>> >>> Reviewed-by: Mohamed Mediouni >>> Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/5052 >>> Link: https://lore.kernel.org/qemu-devel/20261130221153.1182504-1- >>> pierrick.bouvier@oss.qualcomm.com >>> Signed-off-by: Pierrick Bouvier >>> --- >>>   include/system/os-win32.h | 14 ++++++++------ >>>   meson.build               |  6 +++--- >>>   2 files changed, 11 insertions(+), 9 deletions(-) >>> >>> diff --git a/include/system/os-win32.h b/include/system/os-win32.h >>> index 22d72babdf4..f3896763cdd 100644 >>> --- a/include/system/os-win32.h >>> +++ b/include/system/os-win32.h >>> @@ -56,19 +56,21 @@ extern "C" { >>>   /* >>>    * On windows-arm64, setjmp is available in only one variant, and >>> longjmp always >>>    * does stack unwinding. This crash with generated code. >>> - * Thus, we use another implementation of setjmp (not windows one), >>> coming from >>> + * Thus, we use another implementation of longjmp (not windows one), >>> coming from >>>    * mingw, which never performs stack unwinding. >>> + * >>> + * mingw used to provide __mingw_setjmp, but it was removed in favor of >>> + * _setjmpex(env, NULL): >>> + * https://github.com/mingw-w64/mingw-w64/ >>> commit/326b51ef75c4dde099edb063a573b7d114a93af1 >>>    */ >>>   #undef setjmp >>>   #undef longjmp >>>   /* >>> - * These functions are not declared in setjmp.h because __aarch64__ >>> defines >>> - * setjmp to _setjmpex instead. However, they are still defined in >>> libmingwex.a, >>> - * which gets linked automatically. >>> + * __mingw_longjmp is not always declared in setjmp.h, but it is >>> defined in >>> + * libmingwex.a, which gets linked automatically. >>>    */ >>> -int __mingw_setjmp(jmp_buf); >>>   void __attribute__((noreturn)) __mingw_longjmp(jmp_buf, int); >>> -#define setjmp(env) __mingw_setjmp(env) >>> +#define setjmp(env) _setjmpex(env, NULL) >>>   #define longjmp(env, val) __mingw_longjmp(env, val) >>>   #elif defined(_WIN64) >>>   /* >>> diff --git a/meson.build b/meson.build >>> index f8dd3926dd8..35e10d8cf10 100644 >>> --- a/meson.build >>> +++ b/meson.build >>> @@ -3209,15 +3209,15 @@ endif >>>   if host_os == 'windows' >>>     mingw_has_setjmp_longjmp = cc.links(''' >>>       #include >>> +    #include >>>       int main(void) { >>>         /* >>> -       * These functions are not available in setjmp header, but may be >>> +       * __mingw_longjmp is not always declared in setjmp header, but >>> may be >>>          * available at link time, from libmingwex.a. >>>          */ >>> -      extern int __mingw_setjmp(jmp_buf); >>>         extern void __attribute__((noreturn)) __mingw_longjmp(jmp_buf, >>> int); >>>         jmp_buf env; >>> -      __mingw_setjmp(env); >>> +      _setjmpex(env, NULL); >>>         __mingw_longjmp(env, 0); >> >> >> Is it really a good idea to mix interfaces like this? >> Surely _setjmpex should be paired with _longjmpex. >> > > _longjmpex triggers a stack unwinding (with SEH), which crashes with our > generated code. That was the original reason to use mingw variants. > the setjmpex does not have any side effect like this, which is why mingw > commit says it can replace __mingw_setjmp, and why they left > __mingw_longjmp. > > IMHO, the right way in MinGW should have been to leave __mingw_setjmp > defined (and defined as _setjmpex) instead of just removing it. > By the way, if you dig on this topic, you'll hear about __USE_MINGW_SETJMP_NON_SEH define, which is supposed to do what we do here. That said, it was introduced 3 years ago, and I didn't test if it still worked as expected. Also, I didn't hear about it before writing the current patch, and since it was already tested/published and that release is in a few days, I thought it was a better thing to send the current one. > I tested this patch on windows-arm64 by the way. > > Regards, > Pierrick