[Mingw-w64-public] [PATCH] stdio: Share the frontend call wrapper assembly across the v*scanf functions

2017-08-03 Thread Martin Storsjö
The code is already structured as a template, with the file specific
definitions at the top. Share the common template content in an included
file instead, reducing duplication.
---
 mingw-w64-crt/Makefile.am |  3 ++-
 mingw-w64-crt/stdio/scanf2-template.S | 30 ++
 mingw-w64-crt/stdio/vfscanf2.S| 25 +
 mingw-w64-crt/stdio/vfwscanf2.S   | 25 +
 mingw-w64-crt/stdio/vsscanf2.S| 25 +
 mingw-w64-crt/stdio/vswscanf2.S   | 25 +
 6 files changed, 36 insertions(+), 97 deletions(-)
 create mode 100644 mingw-w64-crt/stdio/scanf2-template.S

diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 5c219f3..1e6d636 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -1815,7 +1815,8 @@ EXTRA_DIST += revstamp.h \
   crt/ucrtexe.c \
   profile/gcrt0.c \
   profile/COPYING \
-  profile/CYGWIN_LICENSE
+  profile/CYGWIN_LICENSE \
+  stdio/scanf2-template.S
 
 DISTCHECK_CONFIGURE_FLAGS = --host=$(host_triplet) $(withsys)
 
diff --git a/mingw-w64-crt/stdio/scanf2-template.S 
b/mingw-w64-crt/stdio/scanf2-template.S
new file mode 100644
index 000..9ed0cf7
--- /dev/null
+++ b/mingw-w64-crt/stdio/scanf2-template.S
@@ -0,0 +1,30 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+
+#if defined(_ARM_) || defined(__arm__)
+.thumb
+#endif
+.text
+.p2align 4,,15
+.globl  FCT
+.defFCT;.scl2;  .type   32; .endef
+#ifdef _WIN64
+.seh_proc   FCT
+#endif
+FCT:
+#ifdef _WIN64
+.seh_endprologue
+#endif
+#if defined(_AMD64_) || defined(__x86_64__) || defined(_X86_) || 
defined(__i386__)
+jmp FWD
+#elif defined(_ARM_) || defined(__arm__)
+.thumb_func
+b   FWD
+#endif
+#ifdef _WIN64
+.seh_endproc
+#endif
+.defFWD;  .scl2;  .type   32; .endef
diff --git a/mingw-w64-crt/stdio/vfscanf2.S b/mingw-w64-crt/stdio/vfscanf2.S
index 97807a9..36f38c5 100644
--- a/mingw-w64-crt/stdio/vfscanf2.S
+++ b/mingw-w64-crt/stdio/vfscanf2.S
@@ -9,27 +9,4 @@
 #define FWD __MINGW_USYMBOL(__ms_vfscanf)
 
.file   "vfscanf2.S"
-#if defined(_ARM_) || defined(__arm__)
-.thumb
-#endif
-   .text
-.p2align 4,,15
-.globl  FCT
-.defFCT;.scl2;  .type   32; .endef
-#ifdef _WIN64
-.seh_proc   FCT
-#endif
-FCT:
-#ifdef _WIN64
-.seh_endprologue
-#endif
-#if defined(_AMD64_) || defined(__x86_64__) || defined(_X86_) || 
defined(__i386__)
-jmp FWD
-#elif defined(_ARM_) || defined(__arm__)
-.thumb_func
-b   FWD
-#endif
-#ifdef _WIN64
-.seh_endproc
-#endif
-   .defFWD;  .scl2;  .type   32; .endef
+#include "scanf2-template.S"
diff --git a/mingw-w64-crt/stdio/vfwscanf2.S b/mingw-w64-crt/stdio/vfwscanf2.S
index 77668d8..9d98647 100644
--- a/mingw-w64-crt/stdio/vfwscanf2.S
+++ b/mingw-w64-crt/stdio/vfwscanf2.S
@@ -9,27 +9,4 @@
 #define FWD __MINGW_USYMBOL(__ms_vfwscanf)
 
.file   "vfwscanf2.S"
-#if defined(_ARM_) || defined(__arm__)
-.thumb
-#endif
-   .text
-.p2align 4,,15
-.globl  FCT
-.defFCT;.scl2;  .type   32; .endef
-#ifdef _WIN64
-.seh_proc   FCT
-#endif
-FCT:
-#ifdef _WIN64
-.seh_endprologue
-#endif
-#if defined(_AMD64_) || defined(__x86_64__) || defined(_X86_) || 
defined(__i386__)
-jmp FWD
-#elif defined(_ARM_) || defined(__arm__)
-.thumb_func
-b   FWD
-#endif
-#ifdef _WIN64
-.seh_endproc
-#endif
-   .defFWD;  .scl2;  .type   32; .endef
+#include "scanf2-template.S"
diff --git a/mingw-w64-crt/stdio/vsscanf2.S b/mingw-w64-crt/stdio/vsscanf2.S
index 6a008d4..e840a97 100644
--- a/mingw-w64-crt/stdio/vsscanf2.S
+++ b/mingw-w64-crt/stdio/vsscanf2.S
@@ -9,27 +9,4 @@
 #define FWD __MINGW_USYMBOL(__ms_vsscanf)
 
.file   "vsscanf2.S"
-#if defined(_ARM_) || defined(__arm__)
-.thumb
-#endif
-   .text
-.p2align 4,,15
-.globl  FCT
-.defFCT;.scl2;  .type   32; .endef
-#ifdef _WIN64
-.seh_proc   FCT
-#endif
-FCT:
-#ifdef _WIN64
-.seh_endprologue
-#endif
-#if defined(_AMD64_) || defined(__x86_64__) || defined(_X86_) || 
defined(__i386__)
-jmp FWD
-#elif defined(_ARM_) || defined(__arm__)
-.thumb_func
-b   FWD
-#endif
-#ifdef _WIN64
-.seh_endproc
-#endif
-   .defFWD;  .scl2;  .type   32; .endef
+#include "scanf2-template.S"
diff --git a/mingw-w64-crt/stdio/vswscanf2.S b/mingw-w64-crt/stdio/vswscanf2.S
index 52a4a3f..529f71b 100644
--- a/mingw-w64-crt/stdio/vswscanf2

[Mingw-w64-public] [PATCH 1/5] math: Hook up the return value for sqrt on arm

2017-08-03 Thread Martin Storsjö
---
 mingw-w64-crt/math/sqrt.def.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mingw-w64-crt/math/sqrt.def.h b/mingw-w64-crt/math/sqrt.def.h
index 0cd401d..adb7cf8 100644
--- a/mingw-w64-crt/math/sqrt.def.h
+++ b/mingw-w64-crt/math/sqrt.def.h
@@ -88,7 +88,7 @@ __FLT_ABI (sqrt) (__FLT_TYPE x)
   else if (x == __FLT_CST (1.0))
return __FLT_CST (1.0);
 #if defined(__arm__) || defined(_ARM_)
-  __fsqrt_internal(x);
+  res = __fsqrt_internal(x);
 #elif defined(_X86_) || defined(__i386__) || defined(_AMD64_) || 
defined(__x86_64__)
   asm ("fsqrt" : "=t" (res) : "0" (x));
 #else
-- 
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


[Mingw-w64-public] [PATCH 5/5] stdio: Share the v*scanf assembly wrapper in the scanf.S external asm file

2017-08-03 Thread Martin Storsjö
This reduces code duplication.
---
 mingw-w64-crt/stdio/scanf.S| 30 +-
 mingw-w64-crt/stdio/vfscanf.c  | 35 ---
 mingw-w64-crt/stdio/vfwscanf.c | 35 ---
 mingw-w64-crt/stdio/vsscanf.c  | 35 ---
 mingw-w64-crt/stdio/vswscanf.c | 35 ---
 5 files changed, 29 insertions(+), 141 deletions(-)

diff --git a/mingw-w64-crt/stdio/scanf.S b/mingw-w64-crt/stdio/scanf.S
index e6e9c73..8983190 100644
--- a/mingw-w64-crt/stdio/scanf.S
+++ b/mingw-w64-crt/stdio/scanf.S
@@ -4,7 +4,7 @@
  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
  */
 
-/* vsscanf, vswscanf, vfscanf, and vfwscanf all come here for i386.
+/* vsscanf, vswscanf, vfscanf, and vfwscanf all come here for i386 and arm.
 
The goal of this routine is to turn a call to v*scanf into a call to
s*scanf.  This is needed because mingw-w64 uses msvcr100.dll, which doesn't
@@ -169,4 +169,32 @@ __argtos:
 
 ret
 
+#elif defined (__arm__)
+
+.text
+.align 2
+.thumb_func
+.globl __argtos
+
+__argtos:
+push{r4-r7, lr}
+sub sp, sp, #128
+mov r12, r3
+mov r4, sp
+
+ldr r5, [r2], #4
+ldr r6, [r2], #4
+
+mov r3, #116
+1:  ldr r7, [r2], #4
+str r7, [r4], #4
+subsr3, r3, #4
+bne 1b
+
+mov r2, r5
+mov r3, r6
+blx r12
+add sp, sp, #128
+pop {r4-r7, pc}
+
 #endif
diff --git a/mingw-w64-crt/stdio/vfscanf.c b/mingw-w64-crt/stdio/vfscanf.c
index e316750..ffb5aef 100644
--- a/mingw-w64-crt/stdio/vfscanf.c
+++ b/mingw-w64-crt/stdio/vfscanf.c
@@ -7,9 +7,6 @@
 #include 
 #include 
 
-#if defined(_AMD64_) || defined(__x86_64__) || \
-  defined(_X86_) || defined(__i386__)
-
 extern int __ms_vfscanf_internal (
   FILE * s,
   const char * format,
@@ -17,38 +14,6 @@ extern int __ms_vfscanf_internal (
   int (*func)(FILE * __restrict__,  const char * __restrict__, ...))
   asm("__argtos");
 
-#elif defined (__arm__) || defined (_ARM_)
-
-int __ms_vfscanf_internal (FILE * __restrict__,
-  const char * __restrict__, va_list,
-  int (*func)(FILE * __restrict__,  const char * __restrict__, ...));
-asm("\t.text\n"
-"\t.align 2\n"
-"\t.thumb_func\n"
-"\t.globl __ms_vfscanf_internal\n"
-"__ms_vfscanf_internal:\n\t"
-"push {r4-r7, lr}\n\t"
-"sub sp, sp, #128\n\t"
-"mov r12, r3\n\t"
-"mov r4, sp\n\t"
-
-"ldr r5, [r2], #4\n\t"
-"ldr r6, [r2], #4\n\t"
-
-"mov r3, #116\n\t"
-"1: ldr r7, [r2], #4\n\t"
-"str r7, [r4], #4\n\t"
-"subs r3, r3, #4\n\t"
-"bne 1b\n\t"
-
-"mov r2, r5\n\t"
-"mov r3, r6\n\t"
-"blx r12\n\t"
-"add sp, sp, #128\n\t"
-"pop {r4-r7, pc}");
-
-#endif /* defined (__arm__) || defined (_ARM_) */
-
 int __ms_vfscanf (FILE * __restrict__ stream, const char * __restrict__ 
format, va_list arg)
 {
   int ret;
diff --git a/mingw-w64-crt/stdio/vfwscanf.c b/mingw-w64-crt/stdio/vfwscanf.c
index f0b4821..6437dc8 100644
--- a/mingw-w64-crt/stdio/vfwscanf.c
+++ b/mingw-w64-crt/stdio/vfwscanf.c
@@ -7,9 +7,6 @@
 #include 
 #include 
 
-#if defined(_AMD64_) || defined(__x86_64__) || \
-  defined(_X86_) || defined(__i386__)
-
 extern int __ms_vfwscanf_internal (
   FILE * s,
   const wchar_t * format,
@@ -17,38 +14,6 @@ extern int __ms_vfwscanf_internal (
   int (*func)(FILE * __restrict__,  const wchar_t * __restrict__, ...))
   asm("__argtos");
 
-#elif defined (__arm__) || defined (_ARM_)
-
-int __ms_vfwscanf_internal (FILE * __restrict__,
-  const wchar_t * __restrict__, va_list,
-  int (*func)(FILE * __restrict__,  const wchar_t * __restrict__, ...));
-asm("\t.text\n"
-"\t.align 2\n"
-"\t.thumb_func\n"
-"\t.globl __ms_vfwscanf_internal\n"
-"__ms_vfwscanf_internal:\n\t"
-"push {r4-r7, lr}\n\t"
-"sub sp, sp, #128\n\t"
-"mov r12, r3\n\t"
-"mov r4, sp\n\t"
-
-"ldr r5, [r2], #4\n\t"
-"ldr r6, [r2], #4\n\t"
-
-"mov r3, #116\n\t"
-"1: ldr r7, [r2], #4\n\t"
-"str r7, [r4], #4\n\t"
-"subs r3, r3, #4\n\t"
-"bne 1b\n\t"
-
-"mov r2, r5\n\t"
-"mov r3, r6\n\t"
-"blx r12\n\t"
-"add sp, sp, #128\n\t"
-"pop {r4-r7, pc}");
-
-#endif /* defined (__arm__) || defined (_ARM_) */
-
 int __ms_vfwscanf (FILE * __restrict__ stream,
   const wchar_t * __restrict__ format, va_list arg)
 {
diff --git a/mingw-w64-crt/stdio/vsscanf.c b/mingw-w64-crt/stdio/vsscanf.c
index 995657d..1566b1b 100644
--- a/mingw-w64-crt/stdio/vsscanf.c
+++ b/mingw-w64-crt/stdio/vsscanf.c
@@ -7,9 +7,6 @@
 #include 
 #include 
 
-#if defined(_AMD64_) || defined(__x86_64__) || \
-  defined(_X86_) || defined(__i386__)
-
 extern int __ms_vsscanf_internal (
   const char * s,
   const char * format,
@@ -17,38 +14,6 @@ extern int __ms_vsscanf_internal (
   int (*func)(const char * __restrict__,  const char * __restrict__, ...))
   asm("__argtos");
 
-#elif defined (__a

[Mingw-w64-public] [PATCH 3/5] stdio: Simplify the arm assembly wrapper function for v*scanf

2017-08-03 Thread Martin Storsjö
Don't store below the stack pointer, but decrement it before
writing; use loads/stores with post increment to avoid manually
incrementing the pointer afterwards. Use subs instead of sub+cmp.
---
 mingw-w64-crt/stdio/vfscanf.c  | 18 ++
 mingw-w64-crt/stdio/vfwscanf.c | 18 ++
 mingw-w64-crt/stdio/vsscanf.c  | 18 ++
 mingw-w64-crt/stdio/vswscanf.c | 18 ++
 4 files changed, 24 insertions(+), 48 deletions(-)

diff --git a/mingw-w64-crt/stdio/vfscanf.c b/mingw-w64-crt/stdio/vfscanf.c
index 0756045..f3b0dfe 100644
--- a/mingw-w64-crt/stdio/vfscanf.c
+++ b/mingw-w64-crt/stdio/vfscanf.c
@@ -30,24 +30,18 @@ asm("\t.text\n"
 "\t.globl __ms_vfscanf_internal\n"
 "__ms_vfscanf_internal:\n\t"
 "push {r4-r7, lr}\n\t"
+"sub sp, sp, #128\n\t"
 "mov r4, sp\n\t"
-"sub r4, r4, #128\n\t"
 
-"ldr r5, [r2]\n\t"
-"add r2, r2, #4\n\t"
-"ldr r6, [r2]\n\t"
-"add r2, r2, #4\n\t"
+"ldr r5, [r2], #4\n\t"
+"ldr r6, [r2], #4\n\t"
 
 "mov r3, #116\n\t"
-"1: ldr r7, [r2]\n\t"
-"add r2, r2, #4\n\t"
-"str r7, [r4]\n\t"
-"add r4, r4, #4\n\t"
-"sub r3, r3, #4\n\t"
-"cmp r3, #0\n\t"
+"1: ldr r7, [r2], #4\n\t"
+"str r7, [r4], #4\n\t"
+"subs r3, r3, #4\n\t"
 "bne 1b\n\t"
 
-"sub sp, sp, #128\n\t"
 "mov r2, r5\n\t"
 "mov r3, r6\n\t"
 "bl " QUOTE(__MINGW_USYMBOL(fscanf)) "\n\t"
diff --git a/mingw-w64-crt/stdio/vfwscanf.c b/mingw-w64-crt/stdio/vfwscanf.c
index dcf0373..d6f5a6f 100644
--- a/mingw-w64-crt/stdio/vfwscanf.c
+++ b/mingw-w64-crt/stdio/vfwscanf.c
@@ -30,24 +30,18 @@ asm("\t.text\n"
 "\t.globl __ms_vfwscanf_internal\n"
 "__ms_vfwscanf_internal:\n\t"
 "push {r4-r7, lr}\n\t"
+"sub sp, sp, #128\n\t"
 "mov r4, sp\n\t"
-"sub r4, r4, #128\n\t"
 
-"ldr r5, [r2]\n\t"
-"add r2, r2, #4\n\t"
-"ldr r6, [r2]\n\t"
-"add r2, r2, #4\n\t"
+"ldr r5, [r2], #4\n\t"
+"ldr r6, [r2], #4\n\t"
 
 "mov r3, #116\n\t"
-"1: ldr r7, [r2]\n\t"
-"add r2, r2, #4\n\t"
-"str r7, [r4]\n\t"
-"add r4, r4, #4\n\t"
-"sub r3, r3, #4\n\t"
-"cmp r3, #0\n\t"
+"1: ldr r7, [r2], #4\n\t"
+"str r7, [r4], #4\n\t"
+"subs r3, r3, #4\n\t"
 "bne 1b\n\t"
 
-"sub sp, sp, #128\n\t"
 "mov r2, r5\n\t"
 "mov r3, r6\n\t"
 "bl " QUOTE(__MINGW_USYMBOL(fwscanf)) "\n\t"
diff --git a/mingw-w64-crt/stdio/vsscanf.c b/mingw-w64-crt/stdio/vsscanf.c
index f837f2c..7c72b6c 100644
--- a/mingw-w64-crt/stdio/vsscanf.c
+++ b/mingw-w64-crt/stdio/vsscanf.c
@@ -30,24 +30,18 @@ asm("\t.text\n"
 "\t.globl __ms_vsscanf_internal\n"
 "__ms_vsscanf_internal:\n\t"
 "push {r4-r7, lr}\n\t"
+"sub sp, sp, #128\n\t"
 "mov r4, sp\n\t"
-"sub r4, r4, #128\n\t"
 
-"ldr r5, [r2]\n\t"
-"add r2, r2, #4\n\t"
-"ldr r6, [r2]\n\t"
-"add r2, r2, #4\n\t"
+"ldr r5, [r2], #4\n\t"
+"ldr r6, [r2], #4\n\t"
 
 "mov r3, #116\n\t"
-"1: ldr r7, [r2]\n\t"
-"add r2, r2, #4\n\t"
-"str r7, [r4]\n\t"
-"add r4, r4, #4\n\t"
-"sub r3, r3, #4\n\t"
-"cmp r3, #0\n\t"
+"1: ldr r7, [r2], #4\n\t"
+"str r7, [r4], #4\n\t"
+"subs r3, r3, #4\n\t"
 "bne 1b\n\t"
 
-"sub sp, sp, #128\n\t"
 "mov r2, r5\n\t"
 "mov r3, r6\n\t"
 "bl " QUOTE(__MINGW_USYMBOL(sscanf)) "\n\t"
diff --git a/mingw-w64-crt/stdio/vswscanf.c b/mingw-w64-crt/stdio/vswscanf.c
index 3bda97c..52ab0d6 100644
--- a/mingw-w64-crt/stdio/vswscanf.c
+++ b/mingw-w64-crt/stdio/vswscanf.c
@@ -30,24 +30,18 @@ asm("\t.text\n"
 "\t.globl __ms_vswscanf_internal\n"
 "__ms_vswscanf_internal:\n\t"
 "push {r4-r7, lr}\n\t"
+"sub sp, sp, #128\n\t"
 "mov r4, sp\n\t"
-"sub r4, r4, #128\n\t"
 
-"ldr r5, [r2]\n\t"
-"add r2, r2, #4\n\t"
-"ldr r6, [r2]\n\t"
-"add r2, r2, #4\n\t"
+"ldr r5, [r2], #4\n\t"
+"ldr r6, [r2], #4\n\t"
 
 "mov r3, #116\n\t"
-"1: ldr r7, [r2]\n\t"
-"add r2, r2, #4\n\t"
-"str r7, [r4]\n\t"
-"add r4, r4, #4\n\t"
-"sub r3, r3, #4\n\t"
-"cmp r3, #0\n\t"
+"1: ldr r7, [r2], #4\n\t"
+"str r7, [r4], #4\n\t"
+"subs r3, r3, #4\n\t"
 "bne 1b\n\t"
 
-"sub sp, sp, #128\n\t"
 "mov r2, r5\n\t"
 "mov r3, r6\n\t"
 "bl " QUOTE(__MINGW_USYMBOL(swscanf)) "\n\t"
-- 
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


[Mingw-w64-public] [PATCH 4/5] stdio: Pass the function to call to the v*scanf asm wrapper

2017-08-03 Thread Martin Storsjö
This unifies the wrappers, allowing to share them as on x86.
---
 mingw-w64-crt/stdio/vfscanf.c  | 14 ++
 mingw-w64-crt/stdio/vfwscanf.c | 14 ++
 mingw-w64-crt/stdio/vsscanf.c  | 14 ++
 mingw-w64-crt/stdio/vswscanf.c | 14 ++
 4 files changed, 24 insertions(+), 32 deletions(-)

diff --git a/mingw-w64-crt/stdio/vfscanf.c b/mingw-w64-crt/stdio/vfscanf.c
index f3b0dfe..e316750 100644
--- a/mingw-w64-crt/stdio/vfscanf.c
+++ b/mingw-w64-crt/stdio/vfscanf.c
@@ -19,11 +19,9 @@ extern int __ms_vfscanf_internal (
 
 #elif defined (__arm__) || defined (_ARM_)
 
-#define QUOTE_(x) #x
-#define QUOTE(x) QUOTE_(x)
-
 int __ms_vfscanf_internal (FILE * __restrict__,
-  const char * __restrict__, va_list);
+  const char * __restrict__, va_list,
+  int (*func)(FILE * __restrict__,  const char * __restrict__, ...));
 asm("\t.text\n"
 "\t.align 2\n"
 "\t.thumb_func\n"
@@ -31,6 +29,7 @@ asm("\t.text\n"
 "__ms_vfscanf_internal:\n\t"
 "push {r4-r7, lr}\n\t"
 "sub sp, sp, #128\n\t"
+"mov r12, r3\n\t"
 "mov r4, sp\n\t"
 
 "ldr r5, [r2], #4\n\t"
@@ -44,7 +43,7 @@ asm("\t.text\n"
 
 "mov r2, r5\n\t"
 "mov r3, r6\n\t"
-"bl " QUOTE(__MINGW_USYMBOL(fscanf)) "\n\t"
+"blx r12\n\t"
 "add sp, sp, #128\n\t"
 "pop {r4-r7, pc}");
 
@@ -55,10 +54,9 @@ int __ms_vfscanf (FILE * __restrict__ stream, const char * 
__restrict__ format,
   int ret;
 
 #if defined(_AMD64_) || defined(__x86_64__) || \
-  defined(_X86_) || defined(__i386__)
+  defined(_X86_) || defined(__i386__) || \
+  defined(_ARM_) || defined(__arm__)
   ret = __ms_vfscanf_internal (stream, format, arg, fscanf);
-#elif defined (_ARM_) || defined (__arm__)
-  ret = __ms_vfscanf_internal (stream, format, arg);
 #else
 #error "unknown platform"
 #endif
diff --git a/mingw-w64-crt/stdio/vfwscanf.c b/mingw-w64-crt/stdio/vfwscanf.c
index d6f5a6f..f0b4821 100644
--- a/mingw-w64-crt/stdio/vfwscanf.c
+++ b/mingw-w64-crt/stdio/vfwscanf.c
@@ -19,11 +19,9 @@ extern int __ms_vfwscanf_internal (
 
 #elif defined (__arm__) || defined (_ARM_)
 
-#define QUOTE_(x) #x
-#define QUOTE(x) QUOTE_(x)
-
 int __ms_vfwscanf_internal (FILE * __restrict__,
-  const wchar_t * __restrict__, va_list);
+  const wchar_t * __restrict__, va_list,
+  int (*func)(FILE * __restrict__,  const wchar_t * __restrict__, ...));
 asm("\t.text\n"
 "\t.align 2\n"
 "\t.thumb_func\n"
@@ -31,6 +29,7 @@ asm("\t.text\n"
 "__ms_vfwscanf_internal:\n\t"
 "push {r4-r7, lr}\n\t"
 "sub sp, sp, #128\n\t"
+"mov r12, r3\n\t"
 "mov r4, sp\n\t"
 
 "ldr r5, [r2], #4\n\t"
@@ -44,7 +43,7 @@ asm("\t.text\n"
 
 "mov r2, r5\n\t"
 "mov r3, r6\n\t"
-"bl " QUOTE(__MINGW_USYMBOL(fwscanf)) "\n\t"
+"blx r12\n\t"
 "add sp, sp, #128\n\t"
 "pop {r4-r7, pc}");
 
@@ -56,10 +55,9 @@ int __ms_vfwscanf (FILE * __restrict__ stream,
   int ret;
 
 #if defined(_AMD64_) || defined(__x86_64__) || \
-  defined(_X86_) || defined(__i386__)
+  defined(_X86_) || defined(__i386__) || \
+  defined(_ARM_) || defined(__arm__)
   ret = __ms_vfwscanf_internal (stream, format, arg, fwscanf);
-#elif defined (_ARM_) || defined (__arm__)
-  ret = __ms_vfwscanf_internal (stream, format, arg);
 #else
 #error "unknown platform"
 #endif
diff --git a/mingw-w64-crt/stdio/vsscanf.c b/mingw-w64-crt/stdio/vsscanf.c
index 7c72b6c..995657d 100644
--- a/mingw-w64-crt/stdio/vsscanf.c
+++ b/mingw-w64-crt/stdio/vsscanf.c
@@ -19,11 +19,9 @@ extern int __ms_vsscanf_internal (
 
 #elif defined (__arm__) || defined (_ARM_)
 
-#define QUOTE_(x) #x
-#define QUOTE(x) QUOTE_(x)
-
 int __ms_vsscanf_internal (const char * __restrict__,
-  const char * __restrict__, va_list);
+  const char * __restrict__, va_list,
+  int (*func)(const char * __restrict__,  const char * __restrict__, ...));
 asm("\t.text\n"
 "\t.align 2\n"
 "\t.thumb_func\n"
@@ -31,6 +29,7 @@ asm("\t.text\n"
 "__ms_vsscanf_internal:\n\t"
 "push {r4-r7, lr}\n\t"
 "sub sp, sp, #128\n\t"
+"mov r12, r3\n\t"
 "mov r4, sp\n\t"
 
 "ldr r5, [r2], #4\n\t"
@@ -44,7 +43,7 @@ asm("\t.text\n"
 
 "mov r2, r5\n\t"
 "mov r3, r6\n\t"
-"bl " QUOTE(__MINGW_USYMBOL(sscanf)) "\n\t"
+"blx r12\n\t"
 "add sp, sp, #128\n\t"
 "pop {r4-r7, pc}");
 
@@ -56,10 +55,9 @@ int __ms_vsscanf (const char * __restrict__ s,
   int ret;
 
 #if defined(_AMD64_) || defined(__x86_64__) || \
-  defined(_X86_) || defined(__i386__)
+  defined(_X86_) || defined(__i386__) || \
+  defined(_ARM_) || defined(__arm__)
   ret = __ms_vsscanf_internal (s, format, arg, sscanf);
-#elif defined (_ARM_) || defined (__arm__)
-  ret = __ms_vsscanf_internal (s, format, arg);
 #else
 #error "unknown platform"
 #endif
diff --git a/mingw-w64-crt/stdio/vswscanf.c b/mingw-w64-crt/stdio/vswscanf.c
index 52ab0d6..eb106b1 100644
--- a/mingw-w64-crt/stdio/vswscanf.c
+++ b/mingw-w64-crt/stdio/vswscanf.c
@@ -19,11 +19,9 @@ extern int __ms_vswscanf_internal (
 
 #elif defined (__arm__) || defined (_ARM_)

[Mingw-w64-public] [PATCH 2/5] math: Avoid defining full functions with inline assembly

2017-08-03 Thread Martin Storsjö
Whatever compiler issue this tried to work around, it seems like
it works with modern clang (which is the only supported
compiler for arm in mingw at the moment) in any case.
---
 mingw-w64-crt/math/lrint.c| 19 +--
 mingw-w64-crt/math/lrintf.c   | 18 --
 mingw-w64-crt/math/rint.c | 23 +++
 mingw-w64-crt/math/rintf.c| 22 ++
 mingw-w64-crt/math/sqrt.def.h | 22 +-
 5 files changed, 27 insertions(+), 77 deletions(-)

diff --git a/mingw-w64-crt/math/lrint.c b/mingw-w64-crt/math/lrint.c
index 0409da6..c97e036 100644
--- a/mingw-w64-crt/math/lrint.c
+++ b/mingw-w64-crt/math/lrint.c
@@ -5,26 +5,17 @@
  */
 #include 
 
-#if defined(__arm__) || defined(_ARM_)
-/* This works around a compiler bug */
-long __lrint_internal( double x );
-asm(".def __lrint_internal; .scl 2; .type 32; .endef\n"
-"\t.text\n"
-"\t.align 4\n"
-"\t.globl __lrint_internal\n"
-"__lrint_internal:\n"
-"\tvcvtr.s32.f64s0, d0\n"
-"\tfmrs r0, s0\n"
-"\tbx lr");
-#endif /* defined(__arm__) || defined(_ARM_) */
-
 long lrint (double x) 
 {
   long retval = 0L;
 #if defined(_AMD64_) || defined(__x86_64__) || defined(_X86_) || 
defined(__i386__)
   __asm__ __volatile__ ("fistpl %0"  : "=m" (retval) : "t" (x) : "st");
 #elif defined(__arm__) || defined(_ARM_)
-retval = __lrint_internal(x);
+  float temp;
+  __asm__ __volatile__ (
+"vcvtr.s32.f64%[tmp], %[src]\n\t"
+"fmrs %[dst], %[tmp]\n\t"
+: [dst] "=r" (retval), [tmp] "=t" (temp) : [src] "w" (x));
 #endif
   return retval;
 }
diff --git a/mingw-w64-crt/math/lrintf.c b/mingw-w64-crt/math/lrintf.c
index 2b6d893..fadc29d 100644
--- a/mingw-w64-crt/math/lrintf.c
+++ b/mingw-w64-crt/math/lrintf.c
@@ -5,26 +5,16 @@
  */
 #include 
 
-#if defined(__arm__) || defined(_ARM_)
-/* This works around a compiler bug */
-long __lrintf_internal( float x );
-asm(".def __lrintf_internal; .scl 2; .type 32; .endef\n"
-"\t.text\n"
-"\t.align 4\n"
-"\t.globl __lrintf_internal\n"
-"__lrintf_internal:\n"
-"\tvcvtr.s32.f32s0, s0\n"
-"\tfmrs r0, s0\n"
-"\tbx lr");
-#endif /* defined(__arm__) || defined(_ARM_) */
-
 long lrintf (float x) 
 {
   long retval = 0l;
 #if defined(_AMD64_) || defined(__x86_64__) || defined(_X86_) || 
defined(__i386__)
   __asm__ __volatile__ ("fistpl %0"  : "=m" (retval) : "t" (x) : "st");
 #elif defined(__arm__) || defined(_ARM_)
-retval = __lrintf_internal(x);
+  __asm__ __volatile__ (
+"vcvtr.s32.f32%[src], %[src]\n\t"
+"fmrs %[dst], %[src]\n\t"
+: [dst] "=r" (retval), [src] "+w" (x));
 #endif
   return retval;
 }
diff --git a/mingw-w64-crt/math/rint.c b/mingw-w64-crt/math/rint.c
index 6d0b632..8d69075 100644
--- a/mingw-w64-crt/math/rint.c
+++ b/mingw-w64-crt/math/rint.c
@@ -5,27 +5,18 @@
  */
 #include 
 
-#if defined(__arm__) || defined(_ARM_)
-/* This works around a compiler bug */
-double __rint_internal( double x );
-asm(".def __rint_internal; .scl 2; .type 32; .endef\n"
-"\t.text\n"
-"\t.align 4\n"
-"\t.globl __rint_internal\n"
-"__rint_internal:\n"
-"\tvcvtr.s32.f64s0, d0\n"
-"\tvcvt.f64.s32 d0, s0\n"
-"\tbx lr");
-#endif /* defined(__arm__) || defined(_ARM_) */
-
 double rint (double x) {
   double retval = 0.0;
 #if defined(_AMD64_) || defined(__x86_64__) || defined(_X86_) || 
defined(__i386__)
   __asm__ __volatile__ ("frndint;" : "=t" (retval) : "0" (x));
 #elif defined(__arm__) || defined(_ARM_)
-if (isnan(x) || isinf(x))
-return x;
-retval = __rint_internal(x);
+  if (isnan(x) || isinf(x))
+return x;
+  float temp;
+  __asm__ __volatile__ (
+"vcvtr.s32.f64%[tmp], %[src]\n\t"
+"vcvt.f64.s32 %[dst], %[tmp]\n\t"
+: [dst] "=w" (retval), [tmp] "=t" (temp) : [src] "w" (x));
 #endif
   return retval;
 }
diff --git a/mingw-w64-crt/math/rintf.c b/mingw-w64-crt/math/rintf.c
index 37d4a92..46b3a47 100644
--- a/mingw-w64-crt/math/rintf.c
+++ b/mingw-w64-crt/math/rintf.c
@@ -5,27 +5,17 @@
  */
 #include 
 
-#if defined(__arm__) || defined(_ARM_)
-/* This works around a compiler bug */
-float __rintf_internal( float x );
-asm(".def __rintf_internal; .scl 2; .type 32; .endef\n"
-"\t.text\n"
-"\t.align 4\n"
-"\t.globl __rintf_internal\n"
-"__rintf_internal:\n"
-"\tvcvtr.s32.f32s0, s0\n"
-"\tvcvt.f32.s32 s0, s0\n"
-"\tbx lr");
-#endif /* defined(__arm__) || defined(_ARM_) */
-
 float rintf (float x) {
   float retval = 0.0F;
 #if defined(_AMD64_) || defined(__x86_64__) || defined(_X86_) || 
defined(__i386__)
   __asm__ __volatile__ ("frndint;": "=t" (retval) : "0" (x));
 #elif defined(__arm__) || defined(_ARM_)
-if (isnan(x) || isinf(x))
-return x;
-retval = __rintf_internal(x);
+  if (isnan(x) || isinf(x))
+return x;
+  __asm__ __volatile__ (
+"vcvtr.s32.f32%[dst], %[src]\n\t"
+"vcvt.f32.s32 %[dst], %[d

Re: [Mingw-w64-public] [PATCH] Handle __CTOR_LIST__ for clang

2017-08-03 Thread Martell Malone
Hey Martin,

Glad to see you following up on my various LLVM adventures :)

From what I remember the initialization is done in mingw-w64/crt/gccmain.c.
I believe it may be possible to add this code and not make is clang
specific.

Before the iteration loop check in __do_global_ctors
and __do_global_dtors check if nptrs+1 is equal to -1 and if so just bump
the counter and continue.
This would mean that programs linked with LD would have an extra 2 pointers
in the table but it should be fine otherwise.

Not sure how others would feel about this though.

Best,
Martell



On Wed, Aug 2, 2017 at 10:22 PM, Martin Storsjö  wrote:

> Hi Martell, André and Kai,
>
> On Sun, 28 Aug 2016, André Hentschel wrote:
>
> Am 09.08.2016 um 11:16 schrieb Kai Tietz:
>>
>>> Hallo Martell,
>>>
>>> patch is ok.  Wouldn't it be better to have those symbols in linker
>>> scrpt instead?  That is actually the way used in ld for it.
>>>
>>> Thanlks,
>>> Kai
>>>
>>> 2016-08-06 5:14 GMT+02:00 Martell Malone :
>>>
 This patch should be the last piece of the puzzle.
 Now c++ works, it relied heavily on ctors which was broken with clang
 and
 lld.


>>
>> Hi,
>>
>> Kai could you please point Martell on some examples or related files in
>> the mingw-w64 tree?
>> I hope this way we can continue to fix this.
>>
>
> I see that this matter stalled last year when this was discussed...
>
> I had a look at this, and if I understand things correctly, this is
> handled somewhere in e.g. https://sourceware.org/git/git
> web.cgi?p=binutils-gdb.git;a=blob;f=ld/scripttempl/pe.sc.
>
> I don't think the LLD COFF linker supports such linker scripts, so I think
> a clang/lld-based mingw needs to do things differently, using something
> like Martell's patch.
>
> One of the downsides of doing things differently between the two, is that
> you basically need to link your executables using a linker that matches the
> compiler used to build the mingw CRT. But I guess this is the only way to
> handle it if things are to work with clang at all, right?
>
> Kai approved the patch last year, so I guess it could be applied as a
> first attempt at least? It shouldn't break the setup for normal users,
> contrary to the patch that was reverted before.
>
> // Martin
> 
> --
> 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
>
--
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


[Mingw-w64-public] [PATCH] Add function aliases in libmsvcrt.a for arm just like on x86/x86_64

2017-08-03 Thread Martin Storsjö
Function aliases aren't supported in genlib though, only in
GNU binutils dlltool (which doesn't support arm) and llvm-dlltool.
It didn't make sense to do this until now, when we have a dlltool
that supports arm.

This adds the function aliases from msvcrt-common.def.in, functions
without a leading underscore (such as open, read, close, which
are remapped to the msvcrt functions _open, _read, _close).
---
 mingw-w64-crt/Makefile.am| 4 ++--
 mingw-w64-crt/libarm32/{msvcrt.def => msvcrt.def.in} | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)
 rename mingw-w64-crt/libarm32/{msvcrt.def => msvcrt.def.in} (99%)

diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 549b4a9..d3d6029 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -1326,8 +1326,8 @@ libarm32_libkernel32_a_CPPFLAGS=$(CPPFLAGSARM32) 
$(extra_include) $(AM_CPPFLAGS)
 
 if !W32API
 libarm32_LIBRARIES += libarm32/libmsvcrt.a
-libarm32_libmsvcrt_a_SOURCES = $(src_msvcrt32)
-libarm32_libmsvcrt_a_AR = $(DTLIBARM32) && $(AR) $(ARFLAGS)
+libarm32_libmsvcrt_a_SOURCES = $(src_msvcrt32) libarm32/msvcrt.def.in
+libarm32_libmsvcrt_a_AR = $(DTDEFARM32) libarm32/msvcrt.def && $(AR) $(ARFLAGS)
 libarm32_libmsvcrt_a_CPPFLAGS=$(CPPFLAGSARM32) -D__LIBMSVCRT__ 
$(extra_include) $(sysincludes)
 EXTRA_libarm32_libmsvcrt_a_DEPENDENCIES=libarm32/msvcrt.def
 endif
diff --git a/mingw-w64-crt/libarm32/msvcrt.def 
b/mingw-w64-crt/libarm32/msvcrt.def.in
similarity index 99%
rename from mingw-w64-crt/libarm32/msvcrt.def
rename to mingw-w64-crt/libarm32/msvcrt.def.in
index 2533d5a..5a3aa74 100644
--- a/mingw-w64-crt/libarm32/msvcrt.def
+++ b/mingw-w64-crt/libarm32/msvcrt.def.in
@@ -5,6 +5,9 @@
 ;
 LIBRARY "msvcrt.dll"
 EXPORTS
+
+#include "msvcrt-common.def.in"
+
 ??0__non_rtti_object@@QAA@ABV0@@Z
 ??0__non_rtti_object@@QAA@PBD@Z
 ??0bad_cast@@AAA@PBQBD@Z
-- 
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


[Mingw-w64-public] New compiler warnings (unused variable)

2017-08-03 Thread Martin Storsjö

Hi niXman,

The recent commit you pushed, "_mingw_no_trailing_slash() for _stat64i32() 
and _wstat64i32()", added compiler warnings about an unused variable "int 
start", in case you want to fix it yourself.


// Martin

--
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


Re: [Mingw-w64-public] [PATCH] Add the sincos* functions on arm, calling into sin/cos separately

2017-08-03 Thread Martin Storsjö

On Thu, 3 Aug 2017, Kai Tietz via Mingw-w64-public wrote:


Hmm,

is there a chance that this source file is used for none ARM?  If so,
we should reject this on top, as other targets (the exisiting ones)
are already providing this function.


Yes, the other targets already provide this function. This file is only 
built for libarm32, not for the other normal targets - just as we do for 
the existing forwarders in math/arm/*.c.


// Martin



Otherwise patch looks ok for me too.

Regards,
Kai

2017-08-03 0:48 GMT+02:00 JonY via Mingw-w64-public
:

On 07/30/2017 07:45 PM, Martin Storsjö wrote:

On arm (unless --enable-experimental=softmath is set), we pass
sin/cos function calls straight through to msvcrt. We normally
provide implementations of the sincos family of functions, that
provide both return values at once. Provide implementations of
these functions that simply call the sin/cos functions.


Looks OK to me.


---
 mingw-w64-crt/Makefile.am   |  2 +-
 mingw-w64-crt/math/arm/sincos.c | 29 +
 2 files changed, 30 insertions(+), 1 deletion(-)
 create mode 100644 mingw-w64-crt/math/arm/sincos.c

diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 83dbdf6..549b4a9 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -351,7 +351,7 @@ src_libmingwexarm32=\
   math/softmath/sinf.c  math/softmath/sinl.c  math/softmath/tanf.c 
 math/softmath/tanl.c
 else
 src_libmingwexarm32=\
-  math/arm/exp2.c   math/arm/log2.c   math/arm/scalbn.c
+  math/arm/exp2.c   math/arm/log2.c   math/arm/scalbn.c
 math/arm/sincos.c
 endif


diff --git a/mingw-w64-crt/math/arm/sincos.c b/mingw-w64-crt/math/arm/sincos.c
new file mode 100644
index 000..3bb86ee
--- /dev/null
+++ b/mingw-w64-crt/math/arm/sincos.c
@@ -0,0 +1,29 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+
+#include 
+
+void sincos (double __x, double *p_sin, double *p_cos)
+{
+  *p_sin = sin(__x);
+  *p_cos = cos(__x);
+}
+
+void sincosf (float __x, float *p_sin, float *p_cos)
+{
+  *p_sin = sinf(__x);
+  *p_cos = cosf(__x);
+}
+
+void sincosl (long double __x, long double *p_sin, long double *p_cos)
+{
+#if defined(__arm__) || defined(_ARM_)
+  *p_sin = sin(__x);
+  *p_cos = cos(__x);
+#else
+#error Not supported on your platform yet
+#endif
+}




--
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



--
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

--
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


Re: [Mingw-w64-public] [PATCH] Add the sincos* functions on arm, calling into sin/cos separately

2017-08-03 Thread Kai Tietz via Mingw-w64-public
Hmm,

is there a chance that this source file is used for none ARM?  If so,
we should reject this on top, as other targets (the exisiting ones)
are already providing this function.

Otherwise patch looks ok for me too.

Regards,
Kai

2017-08-03 0:48 GMT+02:00 JonY via Mingw-w64-public
:
> On 07/30/2017 07:45 PM, Martin Storsjö wrote:
>> On arm (unless --enable-experimental=softmath is set), we pass
>> sin/cos function calls straight through to msvcrt. We normally
>> provide implementations of the sincos family of functions, that
>> provide both return values at once. Provide implementations of
>> these functions that simply call the sin/cos functions.
>
> Looks OK to me.
>
>> ---
>>  mingw-w64-crt/Makefile.am   |  2 +-
>>  mingw-w64-crt/math/arm/sincos.c | 29 +
>>  2 files changed, 30 insertions(+), 1 deletion(-)
>>  create mode 100644 mingw-w64-crt/math/arm/sincos.c
>>
>> diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
>> index 83dbdf6..549b4a9 100644
>> --- a/mingw-w64-crt/Makefile.am
>> +++ b/mingw-w64-crt/Makefile.am
>> @@ -351,7 +351,7 @@ src_libmingwexarm32=\
>>math/softmath/sinf.c  math/softmath/sinl.c  math/softmath/tanf.c  
>> math/softmath/tanl.c
>>  else
>>  src_libmingwexarm32=\
>> -  math/arm/exp2.c   math/arm/log2.c   math/arm/scalbn.c
>> +  math/arm/exp2.c   math/arm/log2.c   math/arm/scalbn.c 
>> math/arm/sincos.c
>>  endif
>>
>>
>> diff --git a/mingw-w64-crt/math/arm/sincos.c 
>> b/mingw-w64-crt/math/arm/sincos.c
>> new file mode 100644
>> index 000..3bb86ee
>> --- /dev/null
>> +++ b/mingw-w64-crt/math/arm/sincos.c
>> @@ -0,0 +1,29 @@
>> +/**
>> + * This file has no copyright assigned and is placed in the Public Domain.
>> + * This file is part of the mingw-w64 runtime package.
>> + * No warranty is given; refer to the file DISCLAIMER.PD within this 
>> package.
>> + */
>> +
>> +#include 
>> +
>> +void sincos (double __x, double *p_sin, double *p_cos)
>> +{
>> +  *p_sin = sin(__x);
>> +  *p_cos = cos(__x);
>> +}
>> +
>> +void sincosf (float __x, float *p_sin, float *p_cos)
>> +{
>> +  *p_sin = sinf(__x);
>> +  *p_cos = cosf(__x);
>> +}
>> +
>> +void sincosl (long double __x, long double *p_sin, long double *p_cos)
>> +{
>> +#if defined(__arm__) || defined(_ARM_)
>> +  *p_sin = sin(__x);
>> +  *p_cos = cos(__x);
>> +#else
>> +#error Not supported on your platform yet
>> +#endif
>> +}
>>
>
>
> --
> 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
>

--
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


Re: [Mingw-w64-public] [PATCH] Add a dlltool machine flag for targeting arm

2017-08-03 Thread JonY via Mingw-w64-public
On 08/03/2017 05:51 AM, Martin Storsjö wrote:
> On Wed, 2 Aug 2017, JonY via Mingw-w64-public wrote:
> 
>> On 07/30/2017 07:46 PM, Martin Storsjö wrote:
>>> The GNU binutils dlltool doesn't actually support this
>>> target, but llvm-dlltool does.
>>> ---
>>>  mingw-w64-crt/Makefile.am | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
>>> index 8b6df25..83dbdf6 100644
>>> --- a/mingw-w64-crt/Makefile.am
>>> +++ b/mingw-w64-crt/Makefile.am
>>> @@ -35,7 +35,7 @@ if WITH_GENLIB
>>>DTDEF64=$(GENLIB) $(DLLTOOLFLAGS64) $(AM_DLLTOOLFLAGS)
>>>  else
>>>AM_DLLTOOLFLAGS=-k --as=$(AS) --output-lib $@
>>> -  DLLTOOLFLAGSARM32=
>>> +  DLLTOOLFLAGSARM32=-m arm
>>>DLLTOOLFLAGS32=--as-flags=--32 -m i386
>>>DLLTOOLFLAGS64=--as-flags=--64 -m i386:x86-64
>>>DTDEFARM32=$(DLLTOOL) $(DLLTOOLFLAGSARM32) $(AM_DLLTOOLFLAGS)
>>> --input-def
>>>
>>
>> Can you do a test to see if it is supported? So it doesn't break
>> binutils build.
> 
> Not sure how much sense that would make. Right now, binutils doesn't
> support arm for windows at all (except for old WinCE stuff), so right
> now it doesn't work at all - the only codepath where building worked
> (more or less) so far was with genlib.
> 

In that case, go ahead.



signature.asc
Description: OpenPGP digital signature
--
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