Clang now builds world and kernel, on i386 and amd64

Dimitry Andric dim at FreeBSD.org
Wed Sep 29 19:35:07 UTC 2010


On 2010-09-29 20:22, Renato Botelho wrote:
> It's using drand48() instead of rand()
...
> GCC libc:
> garga at botelhor:~/testes>  ./test
> random value 0.396465
>
> clang libc:
> garga at botelhor:~/testes>  ./test
> random value -inf

Renato, Derek, could you please apply the attached patch for ldexp,
rebuild your libc (with clang), and run your random test program again?
-------------- next part --------------
diff --git a/lib/libc/amd64/gen/ldexp.c b/lib/libc/amd64/gen/ldexp.c
index 43107fc..ecf1ff8 100644
--- a/lib/libc/amd64/gen/ldexp.c
+++ b/lib/libc/amd64/gen/ldexp.c
@@ -36,6 +36,8 @@ static char sccsid[] = "@(#)ldexp.c	8.1 (Berkeley) 6/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
+#include <math.h>
+
 /*
  * ldexp(value, exp): return value * (2 ** exp).
  *
@@ -49,12 +51,16 @@ __FBSDID("$FreeBSD$");
 double
 ldexp (double value, int exp)
 {
-	double temp, texp, temp2;
+	double temp, texp;
+#ifdef __clang__
+	volatile
+#endif
+	double temp2;
 	texp = exp;
 #ifdef __GNUC__
 	__asm ("fscale "
-		: "=u" (temp2), "=t" (temp)
-		: "0" (texp), "1" (value));
+		: "=t" (temp), "=u" (temp2)
+		: "0" (value), "1" (texp));
 #else
 #error unknown asm
 #endif


More information about the freebsd-current mailing list