Hello.

Sending the same patch with more detailed commit message.

Radek
---
>From e5060aa9afc7346301b7f394515d7a280b3c703d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Radek=20Barto=C5=88?= <radek.bar...@microsoft.com>
Date: Mon, 9 Jun 2025 08:45:27 +0200
Subject: [PATCH v2] Cygwin: mkimport: port to support AArch64
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This patch ports winsup/cygwin/scripts/mkimport script to AArch64, namely
implements relocation to the imp_sym.

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

diff --git a/winsup/cygwin/scripts/mkimport b/winsup/cygwin/scripts/mkimport
index 9517c4e9e..0c1bcafbf 100755
--- a/winsup/cygwin/scripts/mkimport
+++ b/winsup/cygwin/scripts/mkimport
@@ -24,6 +24,7 @@ my %import = ();
 my %symfile = ();
 
 my $is_x86_64 = ($cpu eq 'x86_64' ? 1 : 0);
+my $is_aarch64 = ($cpu eq 'aarch64' ? 1 : 0);
 # FIXME? Do other (non-32 bit) arches on Windows still use symbol prefixes?
 my $sym_prefix = '';
 
@@ -65,6 +66,16 @@ for my $f (keys %text) {
        .global $glob_sym
 $glob_sym:
        jmp     *$imp_sym(%rip)
+EOF
+       } elsif ($is_aarch64) {
+           print $as_fd <<EOF;
+       .text
+       .extern $imp_sym
+       .global $glob_sym
+$glob_sym:
+       adr x16, $imp_sym
+       ldr x16, [x16]
+       br x16
 EOF
        } else {
            print $as_fd <<EOF;
-- 
2.50.1.vfs.0.0

Attachment: v2-0001-Cygwin-mkimport-port-to-support-AArch64.patch
Description: v2-0001-Cygwin-mkimport-port-to-support-AArch64.patch

Reply via email to