Re: clang amd64 libm: declare copysign() correctly

2016-12-21 Thread Philip Guenther
On Wed, Dec 21, 2016 at 4:49 AM, Mark Kettenis  wrote:
>> Date: Wed, 21 Dec 2016 13:28:26 +0100
>> From: Christian Weisgerber 
>>
>> libm uses copysign() and copysignf() internally, but fails to declare
>> the amd64 assembly versions that way.  When built with clang, this
>> results in undefined references to _libm_copysign etc.
>>
>> Presumably gcc replaces those calls to copysign with a builtin, but
>> clang doesn't.
>
> Looks correct to me.  Hopefully guenther@ can confirm?

Looks right.  Might as well make the same change in libm/arch/i387/ so
that they stay in sync for the symbols that they provide.
ok guenther@

(Hmm, copysign(3) doesn't mention that it's in C99)



Re: clang amd64 libm: declare copysign() correctly

2016-12-21 Thread Mark Kettenis
> Date: Wed, 21 Dec 2016 13:28:26 +0100
> From: Christian Weisgerber 
> 
> libm uses copysign() and copysignf() internally, but fails to declare
> the amd64 assembly versions that way.  When built with clang, this
> results in undefined references to _libm_copysign etc.
> 
> Presumably gcc replaces those calls to copysign with a builtin, but
> clang doesn't.

Looks correct to me.  Hopefully guenther@ can confirm?

> Index: arch/amd64/s_copysign.S
> ===
> RCS file: /cvs/src/lib/libm/arch/amd64/s_copysign.S,v
> retrieving revision 1.5
> diff -u -p -r1.5 s_copysign.S
> --- arch/amd64/s_copysign.S   12 Sep 2016 19:47:01 -  1.5
> +++ arch/amd64/s_copysign.S   21 Dec 2016 11:46:53 -
> @@ -6,6 +6,8 @@
>  
>  #include 
>  
> +#include "abi.h"
> +
>  .Lpos:
>   .quad   0x8000
>  .Lneg:
> @@ -18,4 +20,4 @@ ENTRY(copysign)
>   pand%xmm3,%xmm0
>   por %xmm1,%xmm0
>   ret
> -END(copysign)
> +END_STD(copysign)
> Index: arch/amd64/s_copysignf.S
> ===
> RCS file: /cvs/src/lib/libm/arch/amd64/s_copysignf.S,v
> retrieving revision 1.5
> diff -u -p -r1.5 s_copysignf.S
> --- arch/amd64/s_copysignf.S  12 Sep 2016 19:47:01 -  1.5
> +++ arch/amd64/s_copysignf.S  21 Dec 2016 11:48:56 -
> @@ -6,6 +6,8 @@
>  
>  #include 
>  
> +#include "abi.h"
> +
>  .Lneg:
>   .long 0x7fff
>  .Lpos:
> @@ -18,4 +20,4 @@ ENTRY(copysignf)
>   pand%xmm3,%xmm0
>   por %xmm1,%xmm0
>   ret
> -END(copysignf)
> +END_STD(copysignf)
> -- 
> Christian "naddy" Weisgerber  na...@mips.inka.de
> 
> 



clang amd64 libm: declare copysign() correctly

2016-12-21 Thread Christian Weisgerber
libm uses copysign() and copysignf() internally, but fails to declare
the amd64 assembly versions that way.  When built with clang, this
results in undefined references to _libm_copysign etc.

Presumably gcc replaces those calls to copysign with a builtin, but
clang doesn't.

Index: arch/amd64/s_copysign.S
===
RCS file: /cvs/src/lib/libm/arch/amd64/s_copysign.S,v
retrieving revision 1.5
diff -u -p -r1.5 s_copysign.S
--- arch/amd64/s_copysign.S 12 Sep 2016 19:47:01 -  1.5
+++ arch/amd64/s_copysign.S 21 Dec 2016 11:46:53 -
@@ -6,6 +6,8 @@
 
 #include 
 
+#include "abi.h"
+
 .Lpos:
.quad   0x8000
 .Lneg:
@@ -18,4 +20,4 @@ ENTRY(copysign)
pand%xmm3,%xmm0
por %xmm1,%xmm0
ret
-END(copysign)
+END_STD(copysign)
Index: arch/amd64/s_copysignf.S
===
RCS file: /cvs/src/lib/libm/arch/amd64/s_copysignf.S,v
retrieving revision 1.5
diff -u -p -r1.5 s_copysignf.S
--- arch/amd64/s_copysignf.S12 Sep 2016 19:47:01 -  1.5
+++ arch/amd64/s_copysignf.S21 Dec 2016 11:48:56 -
@@ -6,6 +6,8 @@
 
 #include 
 
+#include "abi.h"
+
 .Lneg:
.long 0x7fff
 .Lpos:
@@ -18,4 +20,4 @@ ENTRY(copysignf)
pand%xmm3,%xmm0
por %xmm1,%xmm0
ret
-END(copysignf)
+END_STD(copysignf)
-- 
Christian "naddy" Weisgerber  na...@mips.inka.de