https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=3f6ad78936878665495a1d2d3ce13fc8481f39b2

commit 3f6ad78936878665495a1d2d3ce13fc8481f39b2
Author:     Radek Bartoň <radek.bar...@microsoft.com>
AuthorDate: Thu Jun 5 13:15:22 2025 +0200
Commit:     Corinna Vinschen <cori...@vinschen.de>
CommitDate: Wed Jun 25 13:44:28 2025 +0200

    Cygwin: stack base initialization for AArch64
    
    Signed-off-by: Radek Bartoň <radek.bar...@microsoft.com>

Diff:
---
 winsup/cygwin/dcrt0.cc | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index f4c09befd62c..69c233c24759 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -1030,7 +1030,7 @@ _dll_crt0 ()
          PVOID stackaddr = create_new_main_thread_stack (allocationbase);
          if (stackaddr)
            {
-#ifdef __x86_64__
+#if defined(__x86_64__)
              /* Set stack pointer to new address.  Set frame pointer to
                 stack pointer and subtract 32 bytes for shadow space. */
              __asm__ ("\n\
@@ -1038,6 +1038,13 @@ _dll_crt0 ()
                       movq  %%rsp, %%rbp  \n\
                       subq  $32,%%rsp     \n"
                       : : [ADDR] "r" (stackaddr));
+#elif defined(__aarch64__)
+             /* Set stack and frame pointers to new address. */
+             __asm__ ("\n\
+                      mov fp, %[ADDR] \n\
+                      mov sp, fp      \n"
+                      : : [ADDR] "r" (stackaddr)
+                      : "memory");
 #else
 #error unimplemented for this target
 #endif

Reply via email to