[newlib-cygwin/main] Cygwin: gendef: add _sigfe_maybe for TLS initialization checks on AArch64
Corinna Vinschen
corinna@sourceware.org
Fri Jan 16 18:50:37 GMT 2026
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=ae46abc226ce10aa79a9c4a390c74a83c59d47c7
commit ae46abc226ce10aa79a9c4a390c74a83c59d47c7
Author: Thirumalai Nagalingam <thirumalai.nagalingam@multicorewareinc.com>
AuthorDate: Sat Dec 6 19:14:56 2025 +0530
Commit: Corinna Vinschen <corinna@vinschen.de>
CommitDate: Fri Jan 16 19:48:53 2026 +0100
Cygwin: gendef: add _sigfe_maybe for TLS initialization checks on AArch64
Signed-off-by: Thirumalai Nagalingam <thirumalai.nagalingam@multicorewareinc.com>
Diff:
---
winsup/cygwin/scripts/gendef | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/winsup/cygwin/scripts/gendef b/winsup/cygwin/scripts/gendef
index 813857886062..32ceb357802c 100755
--- a/winsup/cygwin/scripts/gendef
+++ b/winsup/cygwin/scripts/gendef
@@ -367,8 +367,24 @@ EOF
.include "tlsoffsets"
.text
-_sigfe_maybe:
- .global _sigbe
+ .seh_proc _sigfe_maybe
+_sigfe_maybe: # stack is aligned on entry!
+ .seh_endprologue
+ ldr x10, [x18, #0x8] // Load TEB pointer in x10
+ ldr x11, =_cygtls.initialized // Load relative offset of _cygtls.initialized
+ add x11, x10, x11 // compute absolute address and store in x11
+ cmp sp, x11 // Compare current stack pointer with TLS location
+ b.hs 0f // if sp >= tls, skip TLS logic
+ ldr w12, [x11] // Load the value at _cygtls.initialized (32-bit)
+ movz w13, #0xc763 // Prepare magic value(0xc763173f) lower 16 bits
+ movk w13, #0x173f, lsl #16 // Add upper 16 bits, full value now in w13
+ cmp w12, w13 // Compare loaded value with magic
+ b.ne 0f // If not equal, not initialized, skip TLS logic
+ ret
+0:
+ ret
+ .seh_endproc
+
_sigfe:
_sigbe:
.global sigdelayed
More information about the Cygwin-cvs
mailing list