Hello.

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

Radek

---
>From 155396dbbd715642dc0fa4f7922e5df4d963b8c3 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] Cygwin: mkimport: port to support 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/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.49.0.vfs.0.4

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

Reply via email to