Re: [Mingw-w64-public] [PATCH 1/3] math: Call the normal double copysign in copysignl on arm

2017-08-04 Thread Martin Storsjö
On Sat, 5 Aug 2017, JonY via Mingw-w64-public wrote: On 08/05/2017 04:38 AM, Martin Storsjö wrote: On Sat, 5 Aug 2017, JonY via Mingw-w64-public wrote: On 08/04/2017 08:37 PM, Martin Storsjö wrote: We already have a C based copysign function which is used on arm. On arm, long double is equal

Re: [Mingw-w64-public] [PATCH 1/3] math: Call the normal double copysign in copysignl on arm

2017-08-04 Thread JonY via Mingw-w64-public
On 08/05/2017 04:38 AM, Martin Storsjö wrote: > On Sat, 5 Aug 2017, JonY via Mingw-w64-public wrote: > >> On 08/04/2017 08:37 PM, Martin Storsjö wrote: >>> We already have a C based copysign function which is used on arm. >>> On arm, long double is equal to double, so just call the normal >>> doub

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

2017-08-04 Thread David Grayson
With your latest two patches, the toolchain compiles but I get an error when building a shared library: /nix/store/k481dhv5hivggnjyb9rs95fz1k6ylhjz-mingw-w64-2017-08-03-i686-w64-mingw32/lib/../lib/libmingw32.a(lib32_libmingw32_a-gccmain.o): In function `_do_global_dtors': /tmp/nix-build-mingw-w64-

Re: [Mingw-w64-public] [PATCH 1/3] math: Call the normal double copysign in copysignl on arm

2017-08-04 Thread Martin Storsjö
On Sat, 5 Aug 2017, JonY via Mingw-w64-public wrote: On 08/04/2017 08:37 PM, Martin Storsjö wrote: We already have a C based copysign function which is used on arm. On arm, long double is equal to double, so just call the normal double function instead of using the handwritten assembly. Chan

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

2017-08-04 Thread David Grayson
Oh, I mean that I got the patch to apply, but I don't know if it really *works*; the toolchain is still building at this time. --David On Fri, Aug 4, 2017 at 6:11 PM, David Grayson wrote: > Your binutils patch did not apply cleanly to binutils-2.27 but I got > it to work. It looks pretty danger

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

2017-08-04 Thread David Grayson
Your binutils patch did not apply cleanly to binutils-2.27 but I got it to work. It looks pretty dangerous to me because you removed the lines for keeping the .dtors, .dtor, .ctors, and .ctor sections. And you're using .ctors and .dtors in your other patch, and other code might use them too I sup

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

2017-08-04 Thread Martell Malone
Hey David, This could be caused by gcc including it's own crtbegin.o and crtend.o I managed to install a toolchain with brew and I swapped out gcc's and mingw-w64's crtbegin and crtend. Everything seems to work here as intended. Attached is an updated patch that avoids crtbegin and crtend that sho

Re: [Mingw-w64-public] [PATCH 1/3] math: Call the normal double copysign in copysignl on arm

2017-08-04 Thread JonY via Mingw-w64-public
On 08/04/2017 08:37 PM, Martin Storsjö wrote: > We already have a C based copysign function which is used on arm. > On arm, long double is equal to double, so just call the normal > double function instead of using the handwritten assembly. > Changes in the series look good for master. signatu

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

2017-08-04 Thread David Grayson
Martell: My setup ( https://github.com/DavidEGrayson/nixcrpkgs ) makes it quite easy to try random patches and make sure that GCC can still be bootstrapped and that I can build non-trivial applications. I tried your patch (after fixing the linebreaks added by GMail) but unfortunately it doesn't w

[Mingw-w64-public] [PATCH 1/3] math: Call the normal double copysign in copysignl on arm

2017-08-04 Thread Martin Storsjö
We already have a C based copysign function which is used on arm. On arm, long double is equal to double, so just call the normal double function instead of using the handwritten assembly. The C based copysign function ends up at 5 instructions including "bx lr", which is significantly shorter tha

[Mingw-w64-public] [PATCH 3/3] math: Correctly handle NAN in nearbyint* and trunc* on arm

2017-08-04 Thread Martin Storsjö
--- mingw-w64-crt/math/nearbyint.S | 7 +++ mingw-w64-crt/math/nearbyintf.S | 7 +++ mingw-w64-crt/math/nearbyintl.S | 7 +++ mingw-w64-crt/math/trunc.S | 7 +++ mingw-w64-crt/math/truncf.S | 7 +++ 5 files changed, 35 insertions(+) diff --git a/mingw-w64-crt/math/ne

[Mingw-w64-public] [PATCH 2/3] math: Round correctly in nearbyintf on arm

2017-08-04 Thread Martin Storsjö
--- mingw-w64-crt/math/nearbyintf.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mingw-w64-crt/math/nearbyintf.S b/mingw-w64-crt/math/nearbyintf.S index 460e1a5..f175175 100644 --- a/mingw-w64-crt/math/nearbyintf.S +++ b/mingw-w64-crt/math/nearbyintf.S @@ -35,7 +35,7 @@ __MI

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

2017-08-04 Thread Martell Malone
Okay lets just solve this. I believe the following should work for both clang and gcc I added a test case at the bottom also. diff --git a/mingw-w64-crt/crt/crtbegin.c b/mingw-w64-crt/crt/crtbegin.c index 39c0d856..1672f7b9 100644 --- a/mingw-w64-crt/crt/crtbegin.c +++ b/mingw-w64-crt/crt/crtbegin

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

2017-08-04 Thread Martin Storsjö
On Fri, 4 Aug 2017, Ruben Van Boxem wrote: Op 3 aug. 2017 9:26 p.m. schreef "Martell Malone" : I for one would like to be able to use one crt with both Clang and GCC. No use in duplicating 99% of the code for that one little bit of startup code that needs to be different. Perhaps ldd or Clang n

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

2017-08-04 Thread David Grayson
Hello. Bellow my signature is a copy of the explanation I sent to the list about why ca451a7 should be reverted. The issue is that different objects are adding constructor pointers to a special section for it, and the CRT need to reliably find the beginning of that section. The CRT uses special

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

2017-08-04 Thread Martin Storsjö
On Thu, 3 Aug 2017, Martell Malone wrote: 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 lo

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

2017-08-04 Thread Ruben Van Boxem
Op 3 aug. 2017 9:26 p.m. schreef "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 iter

[Mingw-w64-public] [PATCH] math: Add a few more missing return statements in arm ifdefs, for __isnanl and __signbitl

2017-08-04 Thread Martin Storsjö
--- mingw-w64-headers/crt/math.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mingw-w64-headers/crt/math.h b/mingw-w64-headers/crt/math.h index 25452a5..6d82c9f 100644 --- a/mingw-w64-headers/crt/math.h +++ b/mingw-w64-headers/crt/math.h @@ -575,7 +575,7 @@ __mingw_choos

[Mingw-w64-public] [PATCH] intrin-impl.h: Fix __buildbittesti for arm

2017-08-04 Thread Martin Storsjö
The local variables contain the full 32 bit value read from the target, and need to be stored in 32 bit variables. The 'old' value read is the full value of the memory location, so we need to extract the specific bit. Mark the output registers as earlyclobber, to make sure they don't alias the regi