Implement the forwarding function in scanf2-template.S and the
va_list unwrapper in the __argtos function in scanf.S, and add
aarch64 to the list of supported architectures in the files that
need it.
---
 mingw-w64-crt/stdio/scanf.S           | 32 ++++++++++++++++++++++++++++++++
 mingw-w64-crt/stdio/scanf2-template.S |  2 ++
 mingw-w64-crt/stdio/vfscanf.c         |  3 ++-
 mingw-w64-crt/stdio/vfwscanf.c        |  3 ++-
 mingw-w64-crt/stdio/vsscanf.c         |  3 ++-
 mingw-w64-crt/stdio/vswscanf.c        |  3 ++-
 6 files changed, 42 insertions(+), 4 deletions(-)

diff --git a/mingw-w64-crt/stdio/scanf.S b/mingw-w64-crt/stdio/scanf.S
index 8983190..3a0e977 100644
--- a/mingw-w64-crt/stdio/scanf.S
+++ b/mingw-w64-crt/stdio/scanf.S
@@ -197,4 +197,36 @@ __argtos:
     add     sp, sp, #128
     pop     {r4-r7, pc}
 
+#elif defined (__aarch64__)
+
+    .text
+    .align 2
+    .globl __argtos
+
+__argtos:
+    stp     x29, x30, [sp, #-16]!
+    mov     x29, sp
+    sub     sp, sp, #256
+    mov     x9, sp
+    mov     x10, x2
+    mov     x11, x3
+
+    ldr     x2, [x10], #8
+    ldr     x3, [x10], #8
+    ldr     x4, [x10], #8
+    ldr     x5, [x10], #8
+    ldr     x6, [x10], #8
+    ldr     x7, [x10], #8
+
+    mov     x12, #240
+1:  ldr     x13, [x10], #8
+    str     x13, [x9], #8
+    subs    x12, x12, #8
+    b.ne    1b
+
+    blr     x11
+    mov     sp, x29
+    ldp     x29, x30, [sp], #16
+    ret
+
 #endif
diff --git a/mingw-w64-crt/stdio/scanf2-template.S 
b/mingw-w64-crt/stdio/scanf2-template.S
index 9ed0cf7..892b7e6 100644
--- a/mingw-w64-crt/stdio/scanf2-template.S
+++ b/mingw-w64-crt/stdio/scanf2-template.S
@@ -23,6 +23,8 @@ FCT:
 #elif defined(_ARM_) || defined(__arm__)
         .thumb_func
         b       FWD
+#elif defined(_ARM64_) || defined(__aarch64__)
+        b       FWD
 #endif
 #ifdef _WIN64
         .seh_endproc
diff --git a/mingw-w64-crt/stdio/vfscanf.c b/mingw-w64-crt/stdio/vfscanf.c
index ffb5aef..dab72fe 100644
--- a/mingw-w64-crt/stdio/vfscanf.c
+++ b/mingw-w64-crt/stdio/vfscanf.c
@@ -20,7 +20,8 @@ int __ms_vfscanf (FILE * __restrict__ stream, const char * 
__restrict__ format,
 
 #if defined(_AMD64_) || defined(__x86_64__) || \
   defined(_X86_) || defined(__i386__) || \
-  defined(_ARM_) || defined(__arm__)
+  defined(_ARM_) || defined(__arm__) || \
+  defined(_ARM64_) || defined(__aarch64__)
   ret = __ms_vfscanf_internal (stream, format, arg, fscanf);
 #else
 #error "unknown platform"
diff --git a/mingw-w64-crt/stdio/vfwscanf.c b/mingw-w64-crt/stdio/vfwscanf.c
index 6437dc8..52cf928 100644
--- a/mingw-w64-crt/stdio/vfwscanf.c
+++ b/mingw-w64-crt/stdio/vfwscanf.c
@@ -21,7 +21,8 @@ int __ms_vfwscanf (FILE * __restrict__ stream,
 
 #if defined(_AMD64_) || defined(__x86_64__) || \
   defined(_X86_) || defined(__i386__) || \
-  defined(_ARM_) || defined(__arm__)
+  defined(_ARM_) || defined(__arm__) || \
+  defined (_ARM64_) || defined (__aarch64__)
   ret = __ms_vfwscanf_internal (stream, format, arg, fwscanf);
 #else
 #error "unknown platform"
diff --git a/mingw-w64-crt/stdio/vsscanf.c b/mingw-w64-crt/stdio/vsscanf.c
index 1566b1b..6c8fe5a 100644
--- a/mingw-w64-crt/stdio/vsscanf.c
+++ b/mingw-w64-crt/stdio/vsscanf.c
@@ -21,7 +21,8 @@ int __ms_vsscanf (const char * __restrict__ s,
 
 #if defined(_AMD64_) || defined(__x86_64__) || \
   defined(_X86_) || defined(__i386__) || \
-  defined(_ARM_) || defined(__arm__)
+  defined(_ARM_) || defined(__arm__) || \
+  defined(_ARM64_) || defined(__aarch64__)
   ret = __ms_vsscanf_internal (s, format, arg, sscanf);
 #else
 #error "unknown platform"
diff --git a/mingw-w64-crt/stdio/vswscanf.c b/mingw-w64-crt/stdio/vswscanf.c
index 7393204..941ed12 100644
--- a/mingw-w64-crt/stdio/vswscanf.c
+++ b/mingw-w64-crt/stdio/vswscanf.c
@@ -21,7 +21,8 @@ int __ms_vswscanf(const wchar_t * __restrict__ s, const 
wchar_t * __restrict__ f
 
 #if defined(_AMD64_) || defined(__x86_64__) || \
   defined(_X86_) || defined(__i386__) || \
-  defined(_ARM_) || defined(__arm__)
+  defined(_ARM_) || defined(__arm__) || \
+  defined(_ARM64_) || defined(__aarch64__)
   ret = __ms_vswscanf_internal (s, format, arg, swscanf);
 #else
 #error "unknown platform"
-- 
2.7.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to