msys2-runtime: more backports

See https://github.com/msys2/msys2-runtime/issues/272
This commit is contained in:
Christoph Reiter 2025-03-30 11:32:15 +02:00
parent 0cc378b430
commit bb910d908d
2 changed files with 46 additions and 1 deletions

View File

@ -4,7 +4,7 @@
pkgbase=msys2-runtime pkgbase=msys2-runtime
pkgname=('msys2-runtime' 'msys2-runtime-devel') pkgname=('msys2-runtime' 'msys2-runtime-devel')
pkgver=3.6.0 pkgver=3.6.0
pkgrel=3 pkgrel=4
pkgdesc="Cygwin POSIX emulation engine" pkgdesc="Cygwin POSIX emulation engine"
arch=('x86_64') arch=('x86_64')
url="https://www.cygwin.com/" url="https://www.cygwin.com/"
@ -30,6 +30,7 @@ makedepends=('cocom'
options=('!zipman') options=('!zipman')
source=('msys2-runtime'::git://sourceware.org/git/newlib-cygwin.git#tag=cygwin-${pkgver} source=('msys2-runtime'::git://sourceware.org/git/newlib-cygwin.git#tag=cygwin-${pkgver}
https://patch-diff.githubusercontent.com/raw/msys2/msys2-runtime/pull/271.patch https://patch-diff.githubusercontent.com/raw/msys2/msys2-runtime/pull/271.patch
signal-crash-backport.patch
msys2-runtime.commit msys2-runtime.commit
0001-Add-MSYS2-triplet.patch 0001-Add-MSYS2-triplet.patch
0002-Fix-msys-library-name-in-import-libraries.patch 0002-Fix-msys-library-name-in-import-libraries.patch
@ -74,6 +75,7 @@ source=('msys2-runtime'::git://sourceware.org/git/newlib-cygwin.git#tag=cygwin-$
0041-Cygwin-console-tty-restore-really-restores-the-previ.patch) 0041-Cygwin-console-tty-restore-really-restores-the-previ.patch)
sha256sums=('89d856fbf9f8d753a644651f95ccd769a43135d93b1bc322582f6fb87ebf4cea' sha256sums=('89d856fbf9f8d753a644651f95ccd769a43135d93b1bc322582f6fb87ebf4cea'
'875c09c99cfa98b7480e7ec37ee211315f3f60b59c14a70760a4f8e2b9cc3c17' '875c09c99cfa98b7480e7ec37ee211315f3f60b59c14a70760a4f8e2b9cc3c17'
'4931b8afe369c1e7a97639e75cf8342c60103e07699ed2acf0c910bf014ae352'
'564998f09ca51148aba183e52ac8e78169c98d3e1a92e163f56a00cd7c840a68' '564998f09ca51148aba183e52ac8e78169c98d3e1a92e163f56a00cd7c840a68'
'5945b95c6b3caf18cc8356802e9af1770746a76c27d0931b897d48d072603fcf' '5945b95c6b3caf18cc8356802e9af1770746a76c27d0931b897d48d072603fcf'
'8f2def0add5397487e2470fd7219bd80233e4d43e9f78d92d042907fede0570a' '8f2def0add5397487e2470fd7219bd80233e4d43e9f78d92d042907fede0570a'
@ -156,6 +158,10 @@ prepare() {
apply_git_am_with_msg 271.patch apply_git_am_with_msg 271.patch
# https://cygwin.com/git/?p=newlib-cygwin.git;a=commit;h=d71aeccff4d219b1cc7a6b0d17dcea7e5bb1b2e9
# https://cygwin.com/git/?p=newlib-cygwin.git;a=commit;h=7f67575711f91ee0b738f836e2ed93c2e41b5248
apply_git_am_with_msg signal-crash-backport.patch
apply_git_am_with_msg 0001-Add-MSYS2-triplet.patch \ apply_git_am_with_msg 0001-Add-MSYS2-triplet.patch \
0002-Fix-msys-library-name-in-import-libraries.patch \ 0002-Fix-msys-library-name-in-import-libraries.patch \
0003-Rename-dll-from-cygwin-to-msys.patch \ 0003-Rename-dll-from-cygwin-to-msys.patch \

View File

@ -0,0 +1,39 @@
diff --git a/winsup/cygwin/scripts/gendef b/winsup/cygwin/scripts/gendef
index a2f0392bc..861a2405b 100755
--- a/winsup/cygwin/scripts/gendef
+++ b/winsup/cygwin/scripts/gendef
@@ -179,6 +179,7 @@ sigdelayed:
movq %rsp,%rbp
pushf
.seh_pushreg %rax # fake, there's no .seh_pushreg for the flags
+ cld # x86_64 ABI requires direction flag cleared
# stack is aligned or unaligned on entry!
# make sure it is aligned from here on
# We could be called from an interrupted thread which doesn't know
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index 2e25aa214..a3aae2ce5 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -1791,6 +1791,13 @@ _cygtls::call_signal_handler ()
to 16 byte. */
uintptr_t new_sp = ((uintptr_t) _my_tls.altstack.ss_sp
+ _my_tls.altstack.ss_size) & ~0xf;
+ /* Copy context1 to the alternate signal stack area, because the
+ context1 allocated in the normal stack area is not accessible
+ from the signal handler that uses alternate signal stack. */
+ thiscontext = (ucontext_t *) ((new_sp - sizeof (ucontext_t)) & ~0xf);
+ memcpy (thiscontext, &context1, sizeof (ucontext_t));
+ new_sp = (uintptr_t) thiscontext;
+
/* In assembler: Save regs on new stack, move to alternate stack,
call thisfunc, revert stack regs. */
#ifdef __x86_64__
@@ -1834,6 +1841,7 @@ _cygtls::call_signal_handler ()
#else
#error unimplemented for this target
#endif
+ memcpy (&context1, thiscontext, sizeof (ucontext_t));
}
else
/* No alternate signal stack requested or available, just call