[Mingw-w64-public] [PATCH] winpthreads: Fix building for ARM and ARM64

2018-05-04 Thread Martin Storsjö
The libgcc stubs aren't necessary if building this when using
compiler-rt, after those stubs are available.

Just make the fake libgcc assembly file a no-op if targeting another
architecture.

Signed-off-by: Martin Storsjö 
---
 mingw-w64-libraries/winpthreads/src/libgcc/dll_dependency.S | 2 ++
 mingw-w64-libraries/winpthreads/src/spinlock.c  | 6 ++
 mingw-w64-libraries/winpthreads/src/thread.c| 6 +-
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/mingw-w64-libraries/winpthreads/src/libgcc/dll_dependency.S 
b/mingw-w64-libraries/winpthreads/src/libgcc/dll_dependency.S
index 2262eb0..0496e94 100644
--- a/mingw-w64-libraries/winpthreads/src/libgcc/dll_dependency.S
+++ b/mingw-w64-libraries/winpthreads/src/libgcc/dll_dependency.S
@@ -1,4 +1,5 @@
 /* Implementation for gcc's internal stack-allocation routines.  */
+#if defined(__i386__) || defined(__x86_64__)
 .global ___chkstk
 .global__alloca
 
@@ -86,3 +87,4 @@ chkstk_end:
pushl   4(%eax)
ret
 #endif
+#endif
diff --git a/mingw-w64-libraries/winpthreads/src/spinlock.c 
b/mingw-w64-libraries/winpthreads/src/spinlock.c
index e55e929..2032d60 100644
--- a/mingw-w64-libraries/winpthreads/src/spinlock.c
+++ b/mingw-w64-libraries/winpthreads/src/spinlock.c
@@ -53,7 +53,13 @@ pthread_spin_lock (pthread_spinlock_t *lock)
   volatile spinlock_word_t *lk = (volatile spinlock_word_t *)lock;
   while (unlikely(__sync_lock_test_and_set(lk, 0) == 0))
 do {
+#if defined(__i386__) || defined(__x86_64__)
   asm("pause" ::: "memory");
+#elif defined(__arm__) || defined(__aarch64__)
+  asm("wfe" ::: "memory");
+#else
+#error Unsupported architecture
+#endif
 } while (*lk == 0);
   return 0;
 }
diff --git a/mingw-w64-libraries/winpthreads/src/thread.c 
b/mingw-w64-libraries/winpthreads/src/thread.c
index fafd915..2b7c7be 100644
--- a/mingw-w64-libraries/winpthreads/src/thread.c
+++ b/mingw-w64-libraries/winpthreads/src/thread.c
@@ -1237,8 +1237,12 @@ pthread_cancel (pthread_t t)
  GetThreadContext(tv->h, &ctxt);
 #ifdef _M_X64
  ctxt.Rip = (uintptr_t) _pthread_invoke_cancel;
-#else
+#elif defined(_M_IX86)
  ctxt.Eip = (uintptr_t) _pthread_invoke_cancel;
+#elif defined(_M_ARM) || defined(_M_ARM64)
+ ctxt.Pc = (uintptr_t) _pthread_invoke_cancel;
+#else
+#error Unsupported architecture
 #endif
  SetThreadContext (tv->h, &ctxt);
 
-- 
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


Re: [Mingw-w64-public] [PATCH] winpthreads: Fix building for ARM and ARM64

2018-05-04 Thread JonY via Mingw-w64-public
On 05/04/2018 09:10 AM, Martin Storsjö wrote:
> The libgcc stubs aren't necessary if building this when using
> compiler-rt, after those stubs are available.
> 
> Just make the fake libgcc assembly file a no-op if targeting another
> architecture.
> 

Patch is OK.



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


Re: [Mingw-w64-public] [PATCH] gendef: Silence warnings about casting function pointers on, GCC 8.

2018-05-04 Thread Liu Hao
在 2018年05月02日 10:53, Liu Hao 写道:
> From ea84b4501db5b7f5eb642751c1418ff23afeb11f Mon Sep 17 00:00:00 2001
> From: Liu Hao 
> Date: Wed, 2 May 2018 10:48:01 +0800
> Subject: [PATCH] gendef: Silence warnings about casting function pointers on
>   GCC 8.
> 
> GCC 8 warns about casting between incompatible pointer to functions.
> This can be worked around by casting the source pointer to an integer
> type before to the destination pointer type.
> 
> Signed-off-by: Liu Hao 
> ---
>   mingw-w64-tools/gendef/src/fsredir.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 

ping ?


-- 
Best regards,
LH_Mouse



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


Re: [Mingw-w64-public] [PATCH] gendef: Silence warnings about casting function pointers on, GCC 8.

2018-05-04 Thread Martin Storsjö

On Wed, 2 May 2018, Liu Hao wrote:


From ea84b4501db5b7f5eb642751c1418ff23afeb11f Mon Sep 17 00:00:00 2001
From: Liu Hao 
Date: Wed, 2 May 2018 10:48:01 +0800
Subject: [PATCH] gendef: Silence warnings about casting function pointers on
 GCC 8.

GCC 8 warns about casting between incompatible pointer to functions.
This can be worked around by casting the source pointer to an integer
type before to the destination pointer type.

Signed-off-by: Liu Hao 
---
 mingw-w64-tools/gendef/src/fsredir.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mingw-w64-tools/gendef/src/fsredir.c 
b/mingw-w64-tools/gendef/src/fsredir.c

index a43dea3a..d729a965 100644
--- a/mingw-w64-tools/gendef/src/fsredir.c
+++ b/mingw-w64-tools/gendef/src/fsredir.c
@@ -41,8 +41,8 @@ void doredirect(const int redir) {
   fprintf(stderr, "kernel32.dll failed to load, failed to disable 
FS redirection.\n");

   return;
 }
-redirectorfunction = (redirector)GetProcAddress(kernel32handle, 
"Wow64DisableWow64FsRedirection");
-revertorfunction = (revertor)GetProcAddress(kernel32handle, 
"Wow64RevertWow64FsRedirection");
+redirectorfunction = 
(redirector)(INT_PTR)GetProcAddress(kernel32handle, 
"Wow64DisableWow64FsRedirection");
+revertorfunction = 
(revertor)(INT_PTR)GetProcAddress(kernel32handle, 
"Wow64RevertWow64FsRedirection");

 if (!redirectorfunction || ! revertorfunction) {
   FreeLibrary(kernel32handle);
   fprintf(stderr, "Wow64DisableWow64FsRedirection or 
Wow64RevertWow64FsRedirection functions missing.\n");

--
2.17.0


Ok with me.

Annoying if GCC now has made this warning even harder to get around...

// 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] winpthreads: Fix building for ARM and ARM64

2018-05-04 Thread Martin Storsjö

On Fri, 4 May 2018, JonY via Mingw-w64-public wrote:


On 05/04/2018 09:10 AM, Martin Storsjö wrote:

The libgcc stubs aren't necessary if building this when using
compiler-rt, after those stubs are available.

Just make the fake libgcc assembly file a no-op if targeting another
architecture.



Patch is OK.


Thanks, pushed.

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


[Mingw-w64-public] mingw-w64 v5 and gcc 8 fails

2018-05-04 Thread Christer Solskogen

It fails with this:

make[1]: Entering directory 
'/tmp/obj/_build/mingw-w64.crt.cross.x86_64-w64-mingw32'
x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I. 
-I/home/solskogen/mingw-w64-builder/trunk/lib/mingw-w64/mingw-w64-crt 
-m64 
-I/home/solskogen/mingw-w64-builder/trunk/lib/mingw-w64/mingw-w64-crt/include 
-D_CRTBLD 
-I/home/solskogen/obj/cross-mingw-w64/x86_64-w64-mingw32/include  -pipe 
-std=gnu99 -D_WIN32_WINNT=0x0f00 -Wall -Wextra -Wformat 
-Wstrict-aliasing -Wshadow -Wpacked -Winline 
-Wimplicit-function-declaration -Wmissing-noreturn -Wmissing-prototypes 
-g -O2 -MT intrincs/lib64_libkernel32_a-rdtsc.o -MD -MP -MF 
intrincs/.deps/lib64_libkernel32_a-rdtsc.Tpo -c -o 
intrincs/lib64_libkernel32_a-rdtsc.o `test -f 'intrincs/rdtsc.c' || echo 
'/home/solskogen/mingw-w64-builder/trunk/lib/mingw-w64/mingw-w64-crt/'`intrincs/rdtsc.c
In file included from 
/tmp/obj/cross-mingw-w64/lib/gcc/x86_64-w64-mingw32/8.1.1/include/x86intrin.h:74,
 from 
/tmp/obj/cross-mingw-w64/x86_64-w64-mingw32/include/intrin.h:73,
 from 
/home/solskogen/mingw-w64-builder/trunk/lib/mingw-w64/mingw-w64-crt/intrincs/rdtsc.c:10:
/tmp/obj/cross-mingw-w64/lib/gcc/x86_64-w64-mingw32/8.1.1/include/xsaveintrin.h:60:1: 
error: conflicting types for '_xgetbv'

 _xgetbv (unsigned int __A)
 ^~~
In file included from 
/tmp/obj/cross-mingw-w64/x86_64-w64-mingw32/include/intrin.h:41,
 from 
/home/solskogen/mingw-w64-builder/trunk/lib/mingw-w64/mingw-w64-crt/intrincs/rdtsc.c:10:
/tmp/obj/cross-mingw-w64/x86_64-w64-mingw32/include/psdk_inc/intrin-impl.h:1412:18: 
note: previous definition of '_xgetbv' was here

 unsigned __int64 _xgetbv(unsigned int index)
  ^~~
Makefile:28152: recipe for target 'intrincs/lib64_libkernel32_a-rdtsc.o' 
failed

make[1]: *** [intrincs/lib64_libkernel32_a-rdtsc.o] Error 1
make[1]: Leaving directory 
'/tmp/obj/_build/mingw-w64.crt.cross.x86_64-w64-mingw32'

Makefile:7778: recipe for target 'all' failed
make: *** [all] Error 2




--
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] gendef: Silence warnings about casting function pointers on, GCC 8.

2018-05-04 Thread Liu Hao

在 2018/5/4 20:14, Martin Storsjö 写道:


Ok with me.

Annoying if GCC now has made this warning even harder to get around...



Pushed.

This is not an old issue, since C never allows such casts, albeit it is 
required by POSIX. The warning can still be observed on an older version 
of GCC with `-pedantic`.



--
Best regards,
LH_Mouse


--
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] gendef: Silence warnings about casting function pointers on, GCC 8.

2018-05-04 Thread Liu Hao

在 2018/5/4 21:06, Liu Hao 写道:

在 2018/5/4 20:14, Martin Storsjö 写道:


Ok with me.

Annoying if GCC now has made this warning even harder to get around...



Pushed.

This is not an old issue, since C never allows such casts, albeit it is 
required by POSIX. The warning can still be observed on an older version 
of GCC with `-pedantic`.





Oh sorry, the warning in older GCC should be about casting from `void *` 
to a function pointer type. `GetProcAddress()` indeed returns a function 
pointer, so it doesn't apply here.


--
Best regards,
LH_Mouse


--
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] mingw-w64 v5 and gcc 8 fails

2018-05-04 Thread JonY via Mingw-w64-public
On 05/04/2018 12:35 PM, Christer Solskogen wrote:
> It fails with this:
> 
> make[1]: Entering directory
> '/tmp/obj/_build/mingw-w64.crt.cross.x86_64-w64-mingw32'
> x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I.
> -I/home/solskogen/mingw-w64-builder/trunk/lib/mingw-w64/mingw-w64-crt
> -m64
> -I/home/solskogen/mingw-w64-builder/trunk/lib/mingw-w64/mingw-w64-crt/include
> -D_CRTBLD
> -I/home/solskogen/obj/cross-mingw-w64/x86_64-w64-mingw32/include  -pipe
> -std=gnu99 -D_WIN32_WINNT=0x0f00 -Wall -Wextra -Wformat
> -Wstrict-aliasing -Wshadow -Wpacked -Winline
> -Wimplicit-function-declaration -Wmissing-noreturn -Wmissing-prototypes
> -g -O2 -MT intrincs/lib64_libkernel32_a-rdtsc.o -MD -MP -MF
> intrincs/.deps/lib64_libkernel32_a-rdtsc.Tpo -c -o
> intrincs/lib64_libkernel32_a-rdtsc.o `test -f 'intrincs/rdtsc.c' || echo
> '/home/solskogen/mingw-w64-builder/trunk/lib/mingw-w64/mingw-w64-crt/'`intrincs/rdtsc.c
> 
> In file included from
> /tmp/obj/cross-mingw-w64/lib/gcc/x86_64-w64-mingw32/8.1.1/include/x86intrin.h:74,
> 
>  from
> /tmp/obj/cross-mingw-w64/x86_64-w64-mingw32/include/intrin.h:73,
>  from
> /home/solskogen/mingw-w64-builder/trunk/lib/mingw-w64/mingw-w64-crt/intrincs/rdtsc.c:10:
> 
> /tmp/obj/cross-mingw-w64/lib/gcc/x86_64-w64-mingw32/8.1.1/include/xsaveintrin.h:60:1:
> error: conflicting types for '_xgetbv'
>  _xgetbv (unsigned int __A)
>  ^~~
> In file included from
> /tmp/obj/cross-mingw-w64/x86_64-w64-mingw32/include/intrin.h:41,
>  from
> /home/solskogen/mingw-w64-builder/trunk/lib/mingw-w64/mingw-w64-crt/intrincs/rdtsc.c:10:
> 
> /tmp/obj/cross-mingw-w64/x86_64-w64-mingw32/include/psdk_inc/intrin-impl.h:1412:18:
> note: previous definition of '_xgetbv' was here
>  unsigned __int64 _xgetbv(unsigned int index)
>   ^~~
> Makefile:28152: recipe for target 'intrincs/lib64_libkernel32_a-rdtsc.o'
> failed
> make[1]: *** [intrincs/lib64_libkernel32_a-rdtsc.o] Error 1
> make[1]: Leaving directory
> '/tmp/obj/_build/mingw-w64.crt.cross.x86_64-w64-mingw32'
> Makefile:7778: recipe for target 'all' failed
> make: *** [all] Error 2

Can you retry with the v5.x branch on git? There are gcc 8 fixes in
included after the last v5 release.



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


Re: [Mingw-w64-public] mingw-w64 v5 and gcc 8 fails

2018-05-04 Thread Mateusz
The patch is only in master (v6) branch
https://sourceforge.net/p/mingw-w64/mingw-w64/ci/3ce3e27f044935f19e93e80c43ca695262d484e1/

JonY could you backport this patch to v5.x branch?

Mateusz


W dniu 04.05.2018 o 16:32, JonY via Mingw-w64-public pisze:
> On 05/04/2018 12:35 PM, Christer Solskogen wrote:
>> It fails with this:
>>
>> make[1]: Entering directory
>> '/tmp/obj/_build/mingw-w64.crt.cross.x86_64-w64-mingw32'
>> x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I.
>> -I/home/solskogen/mingw-w64-builder/trunk/lib/mingw-w64/mingw-w64-crt
>> -m64
>> -I/home/solskogen/mingw-w64-builder/trunk/lib/mingw-w64/mingw-w64-crt/include
>> -D_CRTBLD
>> -I/home/solskogen/obj/cross-mingw-w64/x86_64-w64-mingw32/include  -pipe
>> -std=gnu99 -D_WIN32_WINNT=0x0f00 -Wall -Wextra -Wformat
>> -Wstrict-aliasing -Wshadow -Wpacked -Winline
>> -Wimplicit-function-declaration -Wmissing-noreturn -Wmissing-prototypes
>> -g -O2 -MT intrincs/lib64_libkernel32_a-rdtsc.o -MD -MP -MF
>> intrincs/.deps/lib64_libkernel32_a-rdtsc.Tpo -c -o
>> intrincs/lib64_libkernel32_a-rdtsc.o `test -f 'intrincs/rdtsc.c' || echo
>> '/home/solskogen/mingw-w64-builder/trunk/lib/mingw-w64/mingw-w64-crt/'`intrincs/rdtsc.c
>>
>> In file included from
>> /tmp/obj/cross-mingw-w64/lib/gcc/x86_64-w64-mingw32/8.1.1/include/x86intrin.h:74,
>>
>>  from
>> /tmp/obj/cross-mingw-w64/x86_64-w64-mingw32/include/intrin.h:73,
>>  from
>> /home/solskogen/mingw-w64-builder/trunk/lib/mingw-w64/mingw-w64-crt/intrincs/rdtsc.c:10:
>>
>> /tmp/obj/cross-mingw-w64/lib/gcc/x86_64-w64-mingw32/8.1.1/include/xsaveintrin.h:60:1:
>> error: conflicting types for '_xgetbv'
>>  _xgetbv (unsigned int __A)
>>  ^~~
>> In file included from
>> /tmp/obj/cross-mingw-w64/x86_64-w64-mingw32/include/intrin.h:41,
>>  from
>> /home/solskogen/mingw-w64-builder/trunk/lib/mingw-w64/mingw-w64-crt/intrincs/rdtsc.c:10:
>>
>> /tmp/obj/cross-mingw-w64/x86_64-w64-mingw32/include/psdk_inc/intrin-impl.h:1412:18:
>> note: previous definition of '_xgetbv' was here
>>  unsigned __int64 _xgetbv(unsigned int index)
>>   ^~~
>> Makefile:28152: recipe for target 'intrincs/lib64_libkernel32_a-rdtsc.o'
>> failed
>> make[1]: *** [intrincs/lib64_libkernel32_a-rdtsc.o] Error 1
>> make[1]: Leaving directory
>> '/tmp/obj/_build/mingw-w64.crt.cross.x86_64-w64-mingw32'
>> Makefile:7778: recipe for target 'all' failed
>> make: *** [all] Error 2
> 
> Can you retry with the v5.x branch on git? There are gcc 8 fixes in
> included after the last v5 release.
> 
> 
> 
> --
> 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