[newlib-cygwin/main] Cygwin: gendef: Implement sigsetjmp for AArch64

Corinna Vinschen via Cygwin-cvs <[email protected]> Fri, 16 Jan 2026 18:50:57 +0000 (GMT)
Newsgroups gmane.os.cygwin.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=eb6c6edc32f86bcccc23c2e9aef471e8a015ad75

commit eb6c6edc32f86bcccc23c2e9aef471e8a015ad75
Author:     Thirumalai Nagalingam <[email protected]>
AuthorDate: Sat Dec 6 18:12:43 2025 +0530
Commit:     Corinna Vinschen <[email protected]>
CommitDate: Fri Jan 16 19:48:53 2026 +0100

    Cygwin: gendef: Implement sigsetjmp for AArch64
    
    Co-authored-by: Radek BartoĊˆ <[email protected]>
    
    Signed-off-by: Thirumalai Nagalingam <[email protected]>

Diff:
---
 winsup/cygwin/scripts/gendef | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/winsup/cygwin/scripts/gendef b/winsup/cygwin/scripts/gendef
index b0e4d2a3e507..ff13f1daad69 100755
--- a/winsup/cygwin/scripts/gendef
+++ b/winsup/cygwin/scripts/gendef
@@ -607,7 +607,28 @@ EOF
 	# TODO: These are only stubs, they need to be implemented properly for AArch64.
 	return <<EOF;
 	.globl	sigsetjmp
+	.seh_proc sigsetjmp
 sigsetjmp:
+	// prologue
+	stp		fp, lr, [sp, #-0x10]!	// save FP and LR registers
+	mov		fp, sp			// set FP to current SP
+	.seh_endprologue
+	str	w1, [x0, #0x100]		// buf->savemask = savemask
+	cbz     w1, 1f				// If savemask == 0, skip fetching sigmask
+	mov     x3, x0                        	// save buf in x3
+	sub     sp, sp, #32			// Allocate 32 bytes on stack call
+	mov     x0, #0                         	// SIG_SETMASK
+	mov     x1, xzr                        	// newmask = NULL
+	add     x2, x3, #0x108                 	// &buf->sigmask
+	bl      pthread_sigmask
+	add     sp, sp, #32
+1:
+	bl	setjmp
+	// epilogue
+	ldp	fp, lr, [sp], #0x10		// restore saved FP and LR registers
+	ret
+	.seh_endproc
+
 	.globl  setjmp
 setjmp:
 	.globl	siglongjmp