[haiku-commits] haiku: hrev52155 - src/system/libroot/posix/glibc/arch/x86_64

  • From: waddlesplash <waddlesplash@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 1 Aug 2018 22:41:52 -0400 (EDT)

hrev52155 adds 8 changesets to branch 'master'
old head: b456e5d05551ebe6b57059539725743933087a45
new head: 0dc3ab4f3764a91764b6f5e9938a11f21e1ace38
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=0dc3ab4f3764+%5Eb456e5d05551

----------------------------------------------------------------------------

834100c94ff7: libroot/glibc: Merge newer e_expl* files.
  
  These versions (from ~2015 glibc) do not use some GCC-specific extensions
  that Clang's integrated assembler does not like.

                              [ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]

ca57e33abb4f: libroot/glibc: Use .double instead of .tfloat on Clang.
  
  Clang's equivalent of .tfloat is .x86_fp80, but apparently that
  is not enabled for Haiku. So for now, use .double instead.
  This is the same thing MinGW does.

                              [ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]

c44472c541b5: Enable use of Clang's integrated assembler.

                              [ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]

1c307243f515: configure: Detect lld and elfedit properly under Clang.

                              [ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]

a107d3b4f964: configure: Do --update check earlier.
  
  Previously we initialized variables and ran a few $CC tests first
  (which was what the old version of --update needed.) Now, we can do it
  almost immediately after the script begins.
  
  Spotted by running --update on a GCCless system (as the $CC tests
  gave warning messages due to no GCC, while CC= was set in --update
  environs.)

                              [ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]

20dbf0326723: configure: Allow Clang for ARM builds.

                          [ Alexander von Gluck IV <kallisti5@xxxxxxxxxxx> ]

d9f698eaf0b7: configure: Fix copying clang_headers for non-x86 architectures.
  
  Also allow Clang for PowerPC builds.

                              [ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]

0dc3ab4f3764: libnetapi: Do not use the freebsd11_network headers globally.
  
  Since they were being Use'd at global scope, the FreeBSD versions
  of a number of POSIX headers were being used instead of the POSIX ones,
  which breaks the build on non-x86 as these headers presently do not work
  elsewhere.
  
  Instead, just include the base directory, and then include the compat
  headers manually in the one place that actually requires them.
  Also fix all the other files that expected errno.h and others to
  be included implicitly, which they now are not.
  
  This should fix the PowerPC and (part of the) ARM builds.

                              [ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]

----------------------------------------------------------------------------

14 files changed, 302 insertions(+), 222 deletions(-)
build/jam/ArchitectureRules                      |   5 +-
configure                                        | 106 +++++----
src/kits/network/libnetapi/AbstractSocket.cpp    |   2 +
src/kits/network/libnetapi/DatagramSocket.cpp    |   1 +
src/kits/network/libnetapi/Jamfile               |   3 +-
src/kits/network/libnetapi/NetworkCookie.cpp     |   1 +
src/kits/network/libnetapi/NetworkDevice.cpp     |   2 +
src/kits/network/libnetapi/NetworkRoute.cpp      |   1 +
src/kits/network/libnetapi/Socket.cpp            |   1 +
.../libroot/posix/glibc/arch/x86_64/Jamfile      |   4 +-
.../libroot/posix/glibc/arch/x86_64/e_expl.S     | 226 +++++++++++++++++++
.../libroot/posix/glibc/arch/x86_64/e_expl.c     |  77 -------
.../libroot/posix/glibc/arch/x86_64/s_expm1l.S   |  91 +-------
.../libroot/posix/glibc/arch/x86_64/s_log1pl.S   |   4 +

############################################################################

Commit:      834100c94ff7c713b69c2f89f8955ef048731887
URL:         https://git.haiku-os.org/haiku/commit/?id=834100c94ff7
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Wed Aug  1 22:52:58 2018 UTC

libroot/glibc: Merge newer e_expl* files.

These versions (from ~2015 glibc) do not use some GCC-specific extensions
that Clang's integrated assembler does not like.

----------------------------------------------------------------------------

diff --git a/src/system/libroot/posix/glibc/arch/x86_64/Jamfile 
b/src/system/libroot/posix/glibc/arch/x86_64/Jamfile
index 15129e35ff..80f50cee88 100644
--- a/src/system/libroot/posix/glibc/arch/x86_64/Jamfile
+++ b/src/system/libroot/posix/glibc/arch/x86_64/Jamfile
@@ -23,7 +23,7 @@ SubDirCcFlags -D_GNU_SOURCE -D_IEEE_LIBM -DPIC ;
 SubDirAsFlags -DPIC ;
 
 local genericSources =
-       cmp.c dbl2mpn.c divrem.c 
+       cmp.c dbl2mpn.c divrem.c
        memrchr.c
        mpn2dbl.c mpn2flt.c mpn2ldbl.c
        mul.c mul_n.c
@@ -90,7 +90,7 @@ for architectureObject in [ MultiArchSubDirSetup x86_64 ] {
                local architecture = $(TARGET_PACKAGING_ARCH) ;
 
                MergeObject <$(architecture)>posix_gnu_arch_$(TARGET_ARCH)_e.o :
-                       e_acosl.c e_atan2l.c e_exp2l.S e_expl.c e_fmodl.S 
e_log10l.S
+                       e_acosl.c e_atan2l.c e_exp2l.S e_expl.S e_fmodl.S 
e_log10l.S
                        e_log2l.S e_logl.S e_powl.S e_remainderl.S 
e_rem_pio2l.c e_scalbl.S
                        e_sqrt.c e_sqrtf.c e_sqrtl.c
                        ;
diff --git a/src/system/libroot/posix/glibc/arch/x86_64/e_expl.S 
b/src/system/libroot/posix/glibc/arch/x86_64/e_expl.S
new file mode 100644
index 0000000000..14dd29dcad
--- /dev/null
+++ b/src/system/libroot/posix/glibc/arch/x86_64/e_expl.S
@@ -0,0 +1,226 @@
+/*
+ * Written by J.T. Conklin <jtc@xxxxxxxxxx>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@xxxxxxxxxx>.
+ */
+
+/*
+ * The 8087 method for the exponential function is to calculate
+ *   exp(x) = 2^(x log2(e))
+ * after separating integer and fractional parts
+ *   x log2(e) = i + f, |f| <= .5
+ * 2^i is immediate but f needs to be precise for long double accuracy.
+ * Suppress range reduction error in computing f by the following.
+ * Separate x into integer and fractional parts
+ *   x = xi + xf, |xf| <= .5
+ * Separate log2(e) into the sum of an exact number c0 and small part c1.
+ *   c0 + c1 = log2(e) to extra precision
+ * Then
+ *   f = (c0 xi - i) + c0 xf + c1 x
+ * where c0 xi is exact and so also is (c0 xi - i).
+ * -- moshier@xxxxxxxxxxxxxxx
+ */
+
+#include <machine/asm.h>
+
+#ifdef USE_AS_EXP10L
+# define IEEE754_EXPL __ieee754_exp10l
+# define EXPL_FINITE __exp10l_finite
+# define FLDLOG fldl2t
+#elif defined USE_AS_EXPM1L
+# define IEEE754_EXPL __expm1l
+# undef EXPL_FINITE
+# define FLDLOG fldl2e
+#else
+# define IEEE754_EXPL __ieee754_expl
+# define EXPL_FINITE __expl_finite
+# define FLDLOG fldl2e
+#endif
+
+       .section .rodata.cst16,"aM",@progbits,16
+
+       .p2align 4
+#ifdef USE_AS_EXP10L
+       .type c0,@object
+c0:    .byte 0, 0, 0, 0, 0, 0, 0x9a, 0xd4, 0x00, 0x40
+       .byte 0, 0, 0, 0, 0, 0
+       ASM_SIZE_DIRECTIVE(c0)
+       .type c1,@object
+c1:    .byte 0x58, 0x92, 0xfc, 0x15, 0x37, 0x9a, 0x97, 0xf0, 0xef, 0x3f
+       .byte 0, 0, 0, 0, 0, 0
+       ASM_SIZE_DIRECTIVE(c1)
+#else
+       .type c0,@object
+c0:    .byte 0, 0, 0, 0, 0, 0, 0xaa, 0xb8, 0xff, 0x3f
+       .byte 0, 0, 0, 0, 0, 0
+       ASM_SIZE_DIRECTIVE(c0)
+       .type c1,@object
+c1:    .byte 0x20, 0xfa, 0xee, 0xc2, 0x5f, 0x70, 0xa5, 0xec, 0xed, 0x3f
+       .byte 0, 0, 0, 0, 0, 0
+       ASM_SIZE_DIRECTIVE(c1)
+#endif
+#ifndef USE_AS_EXPM1L
+       .type csat,@object
+csat:  .byte 0, 0, 0, 0, 0, 0, 0, 0x80, 0x0e, 0x40
+       .byte 0, 0, 0, 0, 0, 0
+       ASM_SIZE_DIRECTIVE(csat)
+       .type cmin,@object
+cmin:  .byte 0, 0, 0, 0, 0, 0, 0, 0x80, 0x1, 0
+       .byte 0, 0, 0, 0, 0, 0
+       ASM_SIZE_DIRECTIVE(cmin)
+#endif
+
+#ifdef PIC
+# define MO(op) op##(%rip)
+#else
+# define MO(op) op
+#endif
+
+       .text
+ENTRY(IEEE754_EXPL)
+#ifdef USE_AS_EXPM1L
+       movzwl  8+8(%rsp), %eax
+       xorb    $0x80, %ah      // invert sign bit (now 1 is "positive")
+       cmpl    $0xc006, %eax   // is num positive and exp >= 6 (number is >= 
128.0)?
+       jae     HIDDEN_JUMPTARGET (__expl) // (if num is denormal, it is at 
least >= 64.0)
+#endif
+       fldt    8(%rsp)
+/* I added the following ugly construct because expl(+-Inf) resulted
+   in NaN.  The ugliness results from the bright minds at Intel.
+   For the i686 the code can be written better.
+   -- drepper@xxxxxxxxxx.  */
+       fxam                    /* Is NaN or +-Inf?  */
+#ifdef USE_AS_EXPM1L
+       xorb    $0x80, %ah
+       cmpl    $0xc006, %eax
+       fstsw   %ax
+       movb    $0x45, %dh
+       jb      4f
+
+       /* Below -64.0 (may be -NaN or -Inf). */
+       andb    %ah, %dh
+       cmpb    $0x01, %dh
+       je      2f              /* Is +-NaN, jump.  */
+       jmp     1f              /* -large, possibly -Inf.  */
+
+4:     /* In range -64.0 to 64.0 (may be +-0 but not NaN or +-Inf).  */
+       /* Test for +-0 as argument.  */
+       andb    %ah, %dh
+       cmpb    $0x40, %dh
+       je      2f
+
+       /* Test for arguments that are small but not subnormal.  */
+       movzwl  8+8(%rsp), %eax
+       andl    $0x7fff, %eax
+       cmpl    $0x3fbf, %eax
+       jge     3f
+       /* Argument's exponent below -64; avoid spurious underflow if
+          normal.  */
+       cmpl    $0x0001, %eax
+       jge     2f
+       /* Force underflow and return the argument, to avoid wrong signs
+          of zero results from the code below in some rounding modes.  */
+       fld     %st
+       fmul    %st
+       fstp    %st
+       jmp     2f
+#else
+       movzwl  8+8(%rsp), %eax
+       andl    $0x7fff, %eax
+       cmpl    $0x400d, %eax
+       jg      5f
+       cmpl    $0x3fbc, %eax
+       jge     3f
+       /* Argument's exponent below -67, result rounds to 1.  */
+       fld1
+       faddp
+       jmp     2f
+5:     /* Overflow, underflow or infinity or NaN as argument.  */
+       fstsw   %ax
+       movb    $0x45, %dh
+       andb    %ah, %dh
+       cmpb    $0x05, %dh
+       je      1f              /* Is +-Inf, jump.    */
+       cmpb    $0x01, %dh
+       je      2f              /* Is +-NaN, jump.    */
+       /* Overflow or underflow; saturate.  */
+       fstp    %st
+       fldt    MO(csat)
+       andb    $2, %ah
+       jz      3f
+       fchs
+#endif
+3:     FLDLOG                  /* 1  log2(base)      */
+       fmul    %st(1), %st     /* 1  x log2(base)    */
+       /* Set round-to-nearest temporarily.  */
+       fstcw   -4(%rsp)
+       movl    $0xf3ff, %edx
+       andl    -4(%rsp), %edx
+       movl    %edx, -8(%rsp)
+       fldcw   -8(%rsp)
+       frndint                 /* 1  i               */
+       fld     %st(1)          /* 2  x               */
+       frndint                 /* 2  xi              */
+       fldcw   -4(%rsp)
+       fld     %st(1)          /* 3  i               */
+       fldt    MO(c0)          /* 4  c0              */
+       fld     %st(2)          /* 5  xi              */
+       fmul    %st(1), %st     /* 5  c0 xi           */
+       fsubp   %st, %st(2)     /* 4  f = c0 xi  - i  */
+       fld     %st(4)          /* 5  x               */
+       fsub    %st(3), %st     /* 5  xf = x - xi     */
+       fmulp   %st, %st(1)     /* 4  c0 xf           */
+       faddp   %st, %st(1)     /* 3  f = f + c0 xf   */
+       fldt    MO(c1)          /* 4                  */
+       fmul    %st(4), %st     /* 4  c1 * x          */
+       faddp   %st, %st(1)     /* 3  f = f + c1 * x  */
+       f2xm1                   /* 3 2^(fract(x * log2(base))) - 1 */
+#ifdef USE_AS_EXPM1L
+       fstp    %st(1)          /* 2                  */
+       fscale                  /* 2 scale factor is st(1); base^x - 2^i */
+       fxch                    /* 2 i                */
+       fld1                    /* 3 1.0              */
+       fscale                  /* 3 2^i              */
+       fld1                    /* 4 1.0              */
+       fsubrp  %st, %st(1)     /* 3 2^i - 1.0        */
+       fstp    %st(1)          /* 2                  */
+       faddp   %st, %st(1)     /* 1 base^x - 1.0     */
+#else
+       fld1                    /* 4 1.0              */
+       faddp                   /* 3 2^(fract(x * log2(base))) */
+       fstp    %st(1)          /* 2  */
+       fscale                  /* 2 scale factor is st(1); base^x */
+       fstp    %st(1)          /* 1  */
+       /* Ensure underflow for tiny result.  */
+       fldt    MO(cmin)        /* 2 cmin  */
+       fld     %st(1)          /* 3  */
+       fcomip  %st(1), %st     /* 2  */
+       fstp    %st             /* 1  */
+       jnc     6f
+       fld     %st
+       fmul    %st
+       fstp    %st
+#endif
+6:     fstp    %st(1)          /* 0  */
+       jmp     2f
+1:
+#ifdef USE_AS_EXPM1L
+       /* For expm1l, only negative sign gets here.  */
+       fstp    %st
+       fld1
+       fchs
+#else
+       testl   $0x200, %eax    /* Test sign.  */
+       jz      2f              /* If positive, jump.  */
+       fstp    %st
+       fldz                    /* Set result to 0.  */
+#endif
+2:     ret
+END(IEEE754_EXPL)
+#ifdef USE_AS_EXPM1L
+libm_hidden_def (__expm1l)
+weak_alias (__expm1l, expm1l)
+#else
+strong_alias (IEEE754_EXPL, EXPL_FINITE)
+#endif
diff --git a/src/system/libroot/posix/glibc/arch/x86_64/e_expl.c 
b/src/system/libroot/posix/glibc/arch/x86_64/e_expl.c
deleted file mode 100644
index 1b299239e7..0000000000
--- a/src/system/libroot/posix/glibc/arch/x86_64/e_expl.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Written by J.T. Conklin <jtc@xxxxxxxxxx>.
- * Public domain.
- *
- * Adapted for `long double' by Ulrich Drepper <drepper@xxxxxxxxxx>.
- */
-
-/*
- * The 8087 method for the exponential function is to calculate
- *   exp(x) = 2^(x log2(e))
- * after separating integer and fractional parts
- *   x log2(e) = i + f, |f| <= .5
- * 2^i is immediate but f needs to be precise for long double accuracy.
- * Suppress range reduction error in computing f by the following.
- * Separate x into integer and fractional parts
- *   x = xi + xf, |xf| <= .5
- * Separate log2(e) into the sum of an exact number c0 and small part c1.
- *   c0 + c1 = log2(e) to extra precision
- * Then
- *   f = (c0 xi - i) + c0 xf + c1 x
- * where c0 xi is exact and so also is (c0 xi - i).
- * -- moshier@xxxxxxxxxxxxxxx
- */
-
-#include "math_private.h"
-
-static const long double c0 = 1.44268798828125L;
-static const long double c1 = 7.05260771340735992468e-6L;
-
-long double
-__ieee754_expl (long double x)
-{
-  long double res;
-
-/* I added the following ugly construct because expl(+-Inf) resulted
-   in NaN.  The ugliness results from the bright minds at Intel.
-   For the i686 the code can be written better.
-   -- drepper@xxxxxxxxxx.  */
-  asm ("fxam\n\t"              /* Is NaN or +-Inf?  */
-       "fstsw  %%ax\n\t"
-       "movb   $0x45, %%dh\n\t"
-       "andb   %%ah, %%dh\n\t"
-       "cmpb   $0x05, %%dh\n\t"
-       "je     1f\n\t"         /* Is +-Inf, jump.    */
-       "fldl2e\n\t"             /* 1  log2(e)         */
-       "fmul %%st(1),%%st\n\t"  /* 1  x log2(e)       */
-       "frndint\n\t"            /* 1  i               */
-       "fld %%st(1)\n\t"        /* 2  x               */
-       "frndint\n\t"            /* 2  xi              */
-       "fld %%st(1)\n\t"        /* 3  i               */
-       "fldt %2\n\t"            /* 4  c0              */
-       "fld %%st(2)\n\t"        /* 5  xi              */
-       "fmul %%st(1),%%st\n\t"  /* 5  c0 xi           */
-       "fsubp %%st,%%st(2)\n\t" /* 4  f = c0 xi  - i  */
-       "fld %%st(4)\n\t"        /* 5  x               */
-       "fsub %%st(3),%%st\n\t"  /* 5  xf = x - xi     */
-       "fmulp %%st,%%st(1)\n\t" /* 4  c0 xf           */
-       "faddp %%st,%%st(1)\n\t" /* 3  f = f + c0 xf   */
-       "fldt %3\n\t"            /* 4                  */
-       "fmul %%st(4),%%st\n\t"  /* 4  c1 * x          */
-       "faddp %%st,%%st(1)\n\t" /* 3  f = f + c1 * x  */
-       "f2xm1\n\t"             /* 3 2^(fract(x * log2(e))) - 1 */
-       "fld1\n\t"               /* 4 1.0              */
-       "faddp\n\t"             /* 3 2^(fract(x * log2(e))) */
-       "fstp   %%st(1)\n\t"    /* 2  */
-       "fscale\n\t"            /* 2 scale factor is st(1); e^x */
-       "fstp   %%st(1)\n\t"    /* 1  */
-       "fstp   %%st(1)\n\t"    /* 0  */
-       "jmp 2f\n\t"
-       "1:\ttestl      $0x200, %%eax\n\t"      /* Test sign.  */
-       "jz     2f\n\t"         /* If positive, jump.  */
-       "fstp   %%st\n\t"
-       "fldz\n\t"              /* Set result to 0.  */
-       "2:\t\n"
-       : "=t" (res) : "0" (x), "m" (c0), "m" (c1) : "ax", "dx");
-  return res;
-}
diff --git a/src/system/libroot/posix/glibc/arch/x86_64/s_expm1l.S 
b/src/system/libroot/posix/glibc/arch/x86_64/s_expm1l.S
index eeffc3ebf5..af48f09082 100644
--- a/src/system/libroot/posix/glibc/arch/x86_64/s_expm1l.S
+++ b/src/system/libroot/posix/glibc/arch/x86_64/s_expm1l.S
@@ -1,89 +1,2 @@
-/* ix87 specific implementation of exp(x)-1.
-   Copyright (C) 1996,1997,2001,2002,2008,2009 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
-   Based on code by John C. Bowman <bowman@xxxxxxxxxxxxxxxxxxx>.
-   Corrections by H.J. Lu (hjl@xxxxxxxxxxxxxx), 1997.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-       /* Using: e^x - 1 = 2^(x * log2(e)) - 1 */
-
-#include <machine/asm.h>
-
-#ifdef __ELF__
-       .section .rodata
-#else
-       .text
-#endif
-       .align ALIGNARG(4)
-       ASM_TYPE_DIRECTIVE(minus1,@object)
-minus1:        .double -1.0
-       ASM_SIZE_DIRECTIVE(minus1)
-       ASM_TYPE_DIRECTIVE(one,@object)
-one:   .double 1.0
-       ASM_SIZE_DIRECTIVE(one)
-       ASM_TYPE_DIRECTIVE(l2e,@object)
-l2e:   .tfloat 1.442695040888963407359924681002
-       ASM_SIZE_DIRECTIVE(l2e)
-
-#ifdef PIC
-#define MO(op) op##(%rip)
-#else
-#define MO(op) op
-#endif
-
-       .text
-ENTRY(__expm1l)
-       movzwl  8+8(%rsp), %eax // load sign bit and 15-bit exponent
-       xorb    $0x80, %ah      // invert sign bit (now 1 is "positive")
-       cmpl    $0xc006, %eax   // is num positive and exp >= 6 (number is >= 
128.0)?
-       jae     __expl@PLT      // (if num is denormal, it is at least >= 64.0)
-
-       fldt    8(%rsp)         // x
-       fxam                    // Is NaN or +-Inf?
-       fstsw   %ax
-       movb    $0x45, %ch
-       andb    %ah, %ch
-       cmpb    $0x40, %ch
-       je      3f              // If +-0, jump.
-       cmpb    $0x05, %ch
-       je      2f              // If +-Inf, jump.
-
-       fldt    MO(l2e)         // log2(e) : x
-       fmulp                   // log2(e)*x
-       fld     %st             // log2(e)*x : log2(e)*x
-       frndint                 // int(log2(e)*x) : log2(e)*x
-       fsubr   %st, %st(1)     // int(log2(e)*x) : fract(log2(e)*x)
-       fxch                    // fract(log2(e)*x) : int(log2(e)*x)
-       f2xm1                   // 2^fract(log2(e)*x)-1 : int(log2(e)*x)
-       fscale                  // 2^(log2(e)*x)-2^int(log2(e)*x) : 
int(log2(e)*x)
-       fxch                    // int(log2(e)*x) : 
2^(log2(e)*x)-2^int(log2(e)*x)
-       fldl    MO(one)         // 1 : int(log2(e)*x) : 
2^(log2(e)*x)-2^int(log2(e)*x)
-       fscale                  // 2^int(log2(e)*x) : int(log2(e)*x) : 
2^(log2(e)*x)-2^int(log2(e)*x)
-       fsubrl  MO(one)         // 1-2^int(log2(e)*x) : int(log2(e)*x) : 
2^(log2(e)*x)-2^int(log2(e)*x)
-       fstp    %st(1)          // 1-2^int(log2(e)*x) : 
2^(log2(e)*x)-2^int(log2(e)*x)
-       fsubrp  %st, %st(1)     // 2^(log2(e)*x)-1
-       ret
-
-2:     testl   $0x200, %eax    // Test sign.
-       jz      3f              // If positive, jump.
-       fstp    %st
-       fldl    MO(minus1)      // Set result to -1.0.
-3:     ret
-END(__expm1l)
-libm_hidden_def (__expm1l)
-weak_alias (__expm1l, expm1l)
+#define USE_AS_EXPM1L
+#include "e_expl.S"

############################################################################

Commit:      ca57e33abb4f381ea6af2ae5dd2669453aed2a65
URL:         https://git.haiku-os.org/haiku/commit/?id=ca57e33abb4f
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Wed Aug  1 23:04:25 2018 UTC

libroot/glibc: Use .double instead of .tfloat on Clang.

Clang's equivalent of .tfloat is .x86_fp80, but apparently that
is not enabled for Haiku. So for now, use .double instead.
This is the same thing MinGW does.

----------------------------------------------------------------------------

diff --git a/src/system/libroot/posix/glibc/arch/x86_64/s_log1pl.S 
b/src/system/libroot/posix/glibc/arch/x86_64/s_log1pl.S
index ac2bd22a4f..d6ee1d2f07 100644
--- a/src/system/libroot/posix/glibc/arch/x86_64/s_log1pl.S
+++ b/src/system/libroot/posix/glibc/arch/x86_64/s_log1pl.S
@@ -20,7 +20,11 @@ RCSID("$NetBSD: s_log1p.S,v 1.7 1995/05/09 00:10:58 jtc Exp 
$")
                -1 + sqrt(2) / 2 <= x <= 1 - sqrt(2) / 2
           0.29 is a safe value.
        */
+#ifndef __clang__
 limit: .tfloat 0.29
+#else
+limit: .double 0.29  /* TODO: figure out why x86_fp80 causes clang to error */
+#endif
        /* Please note:  we use a double value here.  Since 1.0 has
           an exact representation this does not effect the accuracy
           but it helps to optimize the code.  */

############################################################################

Commit:      c44472c541b5e8f42c7aca8a51b1f3dff0bb9b10
URL:         https://git.haiku-os.org/haiku/commit/?id=c44472c541b5
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Wed Aug  1 23:09:22 2018 UTC

Enable use of Clang's integrated assembler.

----------------------------------------------------------------------------

diff --git a/build/jam/ArchitectureRules b/build/jam/ArchitectureRules
index de08e22ad4..7e28f03db7 100644
--- a/build/jam/ArchitectureRules
+++ b/build/jam/ArchitectureRules
@@ -474,12 +474,9 @@ rule ArchitectureSetupWarnings architecture
        }
 
        if $(HAIKU_CC_IS_CLANG_$(architecture)) = 1 {
-               # We need -integrated-as, as otherwise Clang uses GCC as 
assembler and
-               # passes -fheinous-gnu-extensions to GCC, which GCC does not 
understand
-               # then errors out.
                AppendToConfigVar CCFLAGS :
                        HAIKU_TOP src system libroot posix glibc :
-                       -integrated-as -fgnu89-inline -fheinous-gnu-extensions 
: global ;
+                       -fgnu89-inline -fheinous-gnu-extensions : global ;
        }
 
        EnableWerror src add-ons accelerants ;
diff --git a/configure b/configure
index dd17c1f7e9..c4c3ed525c 100755
--- a/configure
+++ b/configure
@@ -908,7 +908,7 @@ else
 
                # prepare gcc settings and get the actual target architecture
                if [ $useClang = 1 ]; then
-                       gcc="$HAIKU_clang -target ${targetMachine} 
-no-integrated-as"
+                       gcc="$HAIKU_clang -target ${targetMachine}"
                        if [ ! -z "${crossToolsPrefix}" ]; then
                                gcc="$gcc -B ${crossToolsPrefix}"
                        fi

############################################################################

Commit:      1c307243f5152f65dc2c67fcc82d88b02b6ea953
URL:         https://git.haiku-os.org/haiku/commit/?id=1c307243f515
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Wed Aug  1 23:17:53 2018 UTC

configure: Detect lld and elfedit properly under Clang.

----------------------------------------------------------------------------

diff --git a/configure b/configure
index c4c3ed525c..22ed44bb61 100755
--- a/configure
+++ b/configure
@@ -936,13 +936,11 @@ else
 
                # Override the cross tools variables, if the tools were built 
or a
                # prefix was specified.
-               if [ -n "$crossToolsPrefix" ]; then
-                       get_build_tool_path AR_$targetArch ${crossToolsPrefix}ar
+               if [ $useClang = 1 ]; then
+                       get_build_tool_path LD_$targetArch ld.lld
+                       get_build_tool_path ELFEDIT_$targetArch elfedit
+               elif [ -n "$crossToolsPrefix" ]; then
                        get_build_tool_path LD_$targetArch ${crossToolsPrefix}ld
-                       get_build_tool_path OBJCOPY_$targetArch 
${crossToolsPrefix}objcopy
-                       get_build_tool_path RANLIB_$targetArch 
${crossToolsPrefix}ranlib
-                       get_build_tool_path STRIP_$targetArch 
${crossToolsPrefix}strip
-
                        case `get_variable HAIKU_GCC_RAW_VERSION_$targetArch` in
                                4.*|5.*|6.*|7.*|8.*)
                                        get_build_tool_path ELFEDIT_$targetArch 
\
@@ -950,6 +948,12 @@ else
                                ;;
                        esac
                fi
+               if [ -n "$crossToolsPrefix" ]; then
+                       get_build_tool_path AR_$targetArch ${crossToolsPrefix}ar
+                       get_build_tool_path OBJCOPY_$targetArch 
${crossToolsPrefix}objcopy
+                       get_build_tool_path RANLIB_$targetArch 
${crossToolsPrefix}ranlib
+                       get_build_tool_path STRIP_$targetArch 
${crossToolsPrefix}strip
+               fi
 
                # check whether the Haiku compiler really targets Haiku
                targetMachine=`get_variable HAIKU_GCC_MACHINE_$targetArch`

############################################################################

Commit:      a107d3b4f9644ea2e41f76778109f2927300da4b
URL:         https://git.haiku-os.org/haiku/commit/?id=a107d3b4f964
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Wed Aug  1 23:23:18 2018 UTC

configure: Do --update check earlier.

Previously we initialized variables and ran a few $CC tests first
(which was what the old version of --update needed.) Now, we can do it
almost immediately after the script begins.

Spotted by running --update on a GCCless system (as the $CC tests
gave warning messages due to no GCC, while CC= was set in --update
environs.)

----------------------------------------------------------------------------

diff --git a/configure b/configure
index 22ed44bb61..2a78d939a4 100755
--- a/configure
+++ b/configure
@@ -477,18 +477,46 @@ if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
        usage; exit 0;
 fi
 
-# ensure umask is not too restrictive
-if [ $(umask) -gt 22 ]; then
-       echo "Your umask is too restrictive (should be: <= 0022; is actually:" 
$(umask)")"
-       exit 1
-fi
-
 # get cwd and the source directory
 currentDir=`pwd`
 cd `dirname "$0"`
 sourceDir=`pwd`
 cd "$currentDir"
 
+# determine output directory
+if [ "$currentDir" = "$sourceDir" ]; then
+       outputDir=$currentDir/generated
+else
+       outputDir=$currentDir
+fi
+buildOutputDir="$outputDir/build"
+HAIKU_BUILD_ATTRIBUTES_DIR="$outputDir/attributes"
+buildConfigFile="$buildOutputDir/BuildConfig"
+
+# check for update request
+if [ "$1" = "--update" ]; then
+       if ! [ -e "$buildConfigFile" ]; then
+               echo $0 --update: \'$buildConfigFile\' not found - updating not 
possible.
+               exit 1
+       fi
+       # get last configure invocation and flags from BuildConfig and call 
ourselves with it
+       lastPwd=`grep "#d " "$buildConfigFile" | cut -c 4-`
+       lastConfig=`grep "#c " "$buildConfigFile" | cut -c 4-`
+       lastEnv=`grep "#e " "$buildConfigFile" | cut -c 4-`
+       lastArgs=`grep "#a " "$buildConfigFile" | cut -c 4-`
+       if [ -z "$lastConfig" ]; then
+               echo "$0 --update: The previous configure invocation was not 
properly" \
+                       "encoded into '$buildConfigFile' - updating not 
possible."
+               exit 1
+       fi
+       cd $lastPwd
+       if [ -n "$lastEnv" ]; then
+               export $lastEnv
+       fi
+       $lastConfig $lastArgs
+       exit $?
+fi
+
 # backup the passed arguments
 configureArgs="$@"
 configurePath=$0
@@ -503,6 +531,12 @@ for var in `env`; do
        esac
 done
 
+# ensure umask is not too restrictive
+if [ $(umask) -gt 22 ]; then
+       echo "Your umask is too restrictive (should be: <= 0022; is actually:" 
$(umask)")"
+       exit 1
+fi
+
 # internal default parameter values
 #
 platform=`uname`
@@ -572,40 +606,6 @@ supportedTargetArchs="
        x86_gcc2
        "
 
-# determine output directory
-if [ "$currentDir" = "$sourceDir" ]; then
-       outputDir=$currentDir/generated
-else
-       outputDir=$currentDir
-fi
-buildOutputDir="$outputDir/build"
-HAIKU_BUILD_ATTRIBUTES_DIR="$outputDir/attributes"
-buildConfigFile="$buildOutputDir/BuildConfig"
-
-# check for update request
-if [ "$1" = "--update" ]; then
-       if ! [ -e "$buildConfigFile" ]; then
-               echo $0 --update: \'$buildConfigFile\' not found - updating not 
possible.
-               exit 1
-       fi
-       # get last configure invocation and flags from BuildConfig and call 
ourselves with it
-       lastPwd=`grep "#d " "$buildConfigFile" | cut -c 4-`
-       lastConfig=`grep "#c " "$buildConfigFile" | cut -c 4-`
-       lastEnv=`grep "#e " "$buildConfigFile" | cut -c 4-`
-       lastArgs=`grep "#a " "$buildConfigFile" | cut -c 4-`
-       if [ -z "$lastConfig" ]; then
-               echo "$0 --update: The previous configure invocation was not 
properly" \
-                       "encoded into '$buildConfigFile' - updating not 
possible."
-               exit 1
-       fi
-       cd $lastPwd
-       if [ -n "$lastEnv" ]; then
-               export $lastEnv
-       fi
-       $lastConfig $lastArgs
-       exit $?
-fi
-
 # parse parameters
 #
 while [ $# -gt 0 ] ; do

############################################################################

Commit:      20dbf0326723f1db6cb30ecdef76b4b610b28fef
URL:         https://git.haiku-os.org/haiku/commit/?id=20dbf0326723
Author:      Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date:        Wed Aug  1 23:31:01 2018 UTC
Committer:   Augustin Cavalier <waddlesplash@xxxxxxxxx>
Commit-Date: Wed Aug  1 23:31:01 2018 UTC

configure: Allow Clang for ARM builds.

----------------------------------------------------------------------------

diff --git a/configure b/configure
index 2a78d939a4..b1b4f9b23f 100755
--- a/configure
+++ b/configure
@@ -704,6 +704,7 @@ while [ $# -gt 0 ] ; do
                        case "$targetArch" in
                                x86)            targetMachine=i586-pc-haiku;;
                                x86_64)         
targetMachine=x86_64-unknown-haiku;;
+                               arm)            
targetMachine=arm-unknown-haiku;;
                                *)
                                        echo "Unsupported target architecture: 
$2" >&2
                                        exit 1

############################################################################

Commit:      d9f698eaf0b75dbefdc4ef350b515188efecd6a6
URL:         https://git.haiku-os.org/haiku/commit/?id=d9f698eaf0b7
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Thu Aug  2 00:11:10 2018 UTC

configure: Fix copying clang_headers for non-x86 architectures.

Also allow Clang for PowerPC builds.

----------------------------------------------------------------------------

diff --git a/configure b/configure
index b1b4f9b23f..602ddfda04 100755
--- a/configure
+++ b/configure
@@ -704,6 +704,7 @@ while [ $# -gt 0 ] ; do
                        case "$targetArch" in
                                x86)            targetMachine=i586-pc-haiku;;
                                x86_64)         
targetMachine=x86_64-unknown-haiku;;
+                               ppc)            
targetMachine=powerpc-apple-haiku;;
                                arm)            
targetMachine=arm-unknown-haiku;;
                                *)
                                        echo "Unsupported target architecture: 
$2" >&2
@@ -918,7 +919,11 @@ else
                        # across versions of Clang, so we must collect them for 
use in the build.
                        mkdir -p "$outputDir/clang_headers" || exit 1
                        clangHeadersDir=`$gcc -print-resource-dir`/include/
-                       cp $clangHeadersDir/*intrin* $clangHeadersDir/mm3* 
"$outputDir/clang_headers" || exit 1
+                       case $targetArch in
+                               x86*) cp $clangHeadersDir/*intrin* 
$clangHeadersDir/mm3* "$outputDir/clang_headers" || exit 1 ;;
+                               ppc*) cp $clangHeadersDir/*altivec* 
"$outputDir/clang_headers" || exit 1 ;;
+                               arm*) cp $clangHeadersDir/*arm* 
"$outputDir/clang_headers" || exit 1 ;;
+                       esac
                elif [ -z "${crossToolsPrefix}" ]; then
                        gcc=`get_variable HAIKU_CC_$targetArch`
                else

############################################################################

Revision:    hrev52155
Commit:      0dc3ab4f3764a91764b6f5e9938a11f21e1ace38
URL:         https://git.haiku-os.org/haiku/commit/?id=0dc3ab4f3764
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Thu Aug  2 02:35:47 2018 UTC

libnetapi: Do not use the freebsd11_network headers globally.

Since they were being Use'd at global scope, the FreeBSD versions
of a number of POSIX headers were being used instead of the POSIX ones,
which breaks the build on non-x86 as these headers presently do not work
elsewhere.

Instead, just include the base directory, and then include the compat
headers manually in the one place that actually requires them.
Also fix all the other files that expected errno.h and others to
be included implicitly, which they now are not.

This should fix the PowerPC and (part of the) ARM builds.

----------------------------------------------------------------------------

diff --git a/src/kits/network/libnetapi/AbstractSocket.cpp 
b/src/kits/network/libnetapi/AbstractSocket.cpp
index 1f851a41d3..8caf62c659 100644
--- a/src/kits/network/libnetapi/AbstractSocket.cpp
+++ b/src/kits/network/libnetapi/AbstractSocket.cpp
@@ -8,9 +8,11 @@
 #include <AbstractSocket.h>
 
 #include <arpa/inet.h>
+#include <errno.h>
 #include <fcntl.h>
 #include <netinet/in.h>
 #include <sys/poll.h>
+#include <sys/time.h>
 
 
 //#define TRACE_SOCKET
diff --git a/src/kits/network/libnetapi/DatagramSocket.cpp 
b/src/kits/network/libnetapi/DatagramSocket.cpp
index 26ab20703f..db69cc8504 100644
--- a/src/kits/network/libnetapi/DatagramSocket.cpp
+++ b/src/kits/network/libnetapi/DatagramSocket.cpp
@@ -6,6 +6,7 @@
 
 #include <DatagramSocket.h>
 
+#include <errno.h>
 
 //#define TRACE_SOCKET
 #ifdef TRACE_SOCKET
diff --git a/src/kits/network/libnetapi/Jamfile 
b/src/kits/network/libnetapi/Jamfile
index c4c6bf2560..446f77ae6b 100644
--- a/src/kits/network/libnetapi/Jamfile
+++ b/src/kits/network/libnetapi/Jamfile
@@ -3,8 +3,7 @@ SubDir HAIKU_TOP src kits network libnetapi ;
 UsePrivateHeaders app net shared storage support ;
 UsePrivateHeaders locale shared ;
 
-UseHeaders [ FDirName $(HAIKU_TOP) src libs compat freebsd11_network compat ]
-       : true ;
+UseHeaders [ FDirName $(HAIKU_TOP) src libs compat freebsd11_network ] : true ;
 UseHeaders [ FDirName $(HAIKU_TOP) src libs compat freebsd11_wlan ] : true ;
 UseHeaders [ FDirName $(HAIKU_TOP) headers os add-ons network_settings ]
        : true ;
diff --git a/src/kits/network/libnetapi/NetworkCookie.cpp 
b/src/kits/network/libnetapi/NetworkCookie.cpp
index 41e341d184..317f5066c8 100644
--- a/src/kits/network/libnetapi/NetworkCookie.cpp
+++ b/src/kits/network/libnetapi/NetworkCookie.cpp
@@ -11,6 +11,7 @@
 
 #include <new>
 
+#include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <time.h>
diff --git a/src/kits/network/libnetapi/NetworkDevice.cpp 
b/src/kits/network/libnetapi/NetworkDevice.cpp
index 73f67f003a..47b60741d8 100644
--- a/src/kits/network/libnetapi/NetworkDevice.cpp
+++ b/src/kits/network/libnetapi/NetworkDevice.cpp
@@ -18,6 +18,8 @@
 #include <NetServer.h>
 
 extern "C" {
+#      include <compat/sys/cdefs.h>
+#      include <compat/sys/ioccom.h>
 #      include <net80211/ieee80211_ioctl.h>
 }
 
diff --git a/src/kits/network/libnetapi/NetworkRoute.cpp 
b/src/kits/network/libnetapi/NetworkRoute.cpp
index 8dde3108f0..7d32f26ec3 100644
--- a/src/kits/network/libnetapi/NetworkRoute.cpp
+++ b/src/kits/network/libnetapi/NetworkRoute.cpp
@@ -7,6 +7,7 @@
 
 #include <errno.h>
 #include <net/if.h>
+#include <string.h>
 #include <sys/sockio.h>
 
 #include <AutoDeleter.h>
diff --git a/src/kits/network/libnetapi/Socket.cpp 
b/src/kits/network/libnetapi/Socket.cpp
index 6b891a7f53..69f1845190 100644
--- a/src/kits/network/libnetapi/Socket.cpp
+++ b/src/kits/network/libnetapi/Socket.cpp
@@ -7,6 +7,7 @@
 
 #include <Socket.h>
 
+#include <errno.h>
 
 //#define TRACE_SOCKET
 #ifdef TRACE_SOCKET


Other related posts: