Hello.

This patch aspires to provide only minimal changes to 
`winsup/cygwin/scripts/gendef` allowing to pass the AArch64 build. It does not 
provide any implementations of the generated routines.

Radek

---
>From b6ca8c585dc63ae12de1d30f8684cdec29b3302b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Radek=20Barto=C5=88?= <radek.bar...@microsoft.com>
Date: Fri, 6 Jun 2025 14:31:30 +0200
Subject: [PATCH] Cygwin: gendef: stub implementations of routines for AArch64
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Radek BartoĊˆ <radek.bar...@microsoft.com>
---
 winsup/cygwin/scripts/gendef | 42 +++++++++++++++++++++++++++++++++++-
 1 file changed, 41 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/scripts/gendef b/winsup/cygwin/scripts/gendef
index 861a2405b..1bd724511 100755
--- a/winsup/cygwin/scripts/gendef
+++ b/winsup/cygwin/scripts/gendef
@@ -21,6 +21,7 @@ if (!defined($cpu) || !defined($output_def)) {
     die "$0: missing required option\n";
 }
 
+my $is_aarch64 = $cpu eq 'aarch64';
 my $is_x86_64 = $cpu eq 'x86_64';
 # FIXME? Do other (non-32 bit) arches on Windows still use symbol prefixes?
 my $sym_prefix = '';
@@ -89,7 +90,7 @@ sub fefunc {
     my $func = $sym_prefix . shift;
     my $fe = $sym_prefix . shift;
     my $sigfe_func;
-    if ($is_x86_64) {
+    if ($is_x86_64 || $is_aarch64) {
        $sigfe_func = ($fe =~ /^(.*)_${func}$/)[0];
     }
     my $extra;
@@ -109,6 +110,15 @@ $fe:
 
 EOF
     }
+    # TODO: This is only a stub, it needs to be implemented properly for 
AArch64.
+    if ($is_aarch64) {
+       $res = <<EOF;
+       .extern $func
+       .global $fe
+$fe:
+EOF
+    }
+
     if (!$main::first++) {
        if ($is_x86_64) {
          $res = <<EOF . longjmp () . $res;
@@ -338,6 +348,23 @@ stabilize_sig_stack:
        popq    %r12
        ret
        .seh_endproc
+EOF
+       }
+       # TODO: These are only stubs, they need to be implemented properly for 
AArch64.
+       if ($is_aarch64) {
+         $res = <<EOF . longjmp () . $res;
+       .include "tlsoffsets"
+       .text
+
+_sigfe_maybe:
+       .global _sigbe
+_sigfe:
+_sigbe:
+       .global sigdelayed
+sigdelayed:
+_sigdelayed_end:
+       .global _sigdelayed_end
+stabilize_sig_stack:
 EOF
        }
     }
@@ -474,6 +501,19 @@ longjmp:
        incl    %eax
 0:     ret
        .seh_endproc
+EOF
+    }
+    if ($is_aarch64) {
+       # TODO: These are only stubs, they need to be implemented properly for 
AArch64.
+       return <<EOF;
+       .globl  sigsetjmp
+sigsetjmp:
+       .globl  setjmp
+setjmp:
+       .globl  siglongjmp
+siglongjmp:
+       .globl  longjmp
+longjmp:
 EOF
     }
 }
-- 
2.49.0.vfs.0.4

Attachment: 0001-Cygwin-gendef-stub-implementations-of-routines-for-AArch64.patch
Description: 0001-Cygwin-gendef-stub-implementations-of-routines-for-AArch64.patch

Reply via email to