Cygwin: gendef: add _sigfe_maybe for TLS initialization checks on AArch64

Signed-off-by: Thirumalai Nagalingam <thirumalai.nagalingam@multicorewareinc.com>
This commit is contained in:
Thirumalai Nagalingam authored and Corinna Vinschen committed 2026-01-16 19:48:53 +01:00
1 parent 3dbdee52e2
commit ae46abc226
1 file changed
+18 -2
+18 -2
View File
@@ -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