On Thu, Dec 24, 2015 at 01:18:53PM -0700, Ian Lepore wrote:
> Oh, I know what's likely at the heart of this... I'm using gcc 4.2.1
> for arm v4/v5, because clang 3.7 is broken (works to crossbuild, but
> fails to run native).  The mrrc instruction was introduced at arm arch
> 5E, I'll bet clang is defaulting to 5E and gcc defaults to 4.
> 
> This is what's in my make.conf for the build that failed:
> 
> WITH_GCC=yes
> WITH_GNUCXX=yes
> WITH_GCC_BOOTSTRAP=yes
> WITHOUT_CLANG=yes
> WITHOUT_CLANG_IS_CC=yes
> WITHOUT_CLANG_BOOTSTRAP=yes
> 
> Yep, just confirmed it, switched back to clang 3.7 for crossbuild and
> no errors.

I think that the following is the least intrusive change.  I built it
with your make.conf successfully (and make.conf seems to take effect judging
by the build time).

If you are fine with the change, I will commit right after confirming that
ARMv6 build still results in correct code (building right now).

diff --git a/lib/libc/arm/sys/__vdso_gettc.c b/lib/libc/arm/sys/__vdso_gettc.c
index d75d866..1f43e72 100644
--- a/lib/libc/arm/sys/__vdso_gettc.c
+++ b/lib/libc/arm/sys/__vdso_gettc.c
@@ -34,8 +34,10 @@ __FBSDID("$FreeBSD$");
 #include <sys/time.h>
 #include <sys/vdso.h>
 #include <machine/cpufunc.h>
+#include <machine/acle-compat.h>
 #include "libc_private.h"
 
+#if __ARM_ARCH >= 6
 static inline uint64_t
 cp15_cntvct_get(void)
 {
@@ -53,6 +55,7 @@ cp15_cntpct_get(void)
        __asm __volatile("mrrc\tp15, 0, %Q0, %R0, c14" : "=r" (reg));
        return (reg);
 }
+#endif
 
 #pragma weak __vdso_gettc
 u_int
@@ -60,6 +63,7 @@ __vdso_gettc(const struct vdso_timehands *th)
 {
        uint64_t val;
 
+#if __ARM_ARCH >= 6
        /*
         * Userspace gettimeofday() is only enabled on ARMv7 CPUs, but
         * libc is compiled for ARMv6.  Due to clang issues, .arch
@@ -67,6 +71,9 @@ __vdso_gettc(const struct vdso_timehands *th)
         */
        __asm __volatile(".word\t0xf57ff06f" : : : "memory"); /* isb */
        val = th->th_physical == 0 ? cp15_cntvct_get() : cp15_cntpct_get();
+#else
+       val = 0;
+#endif
        return (val);
 }
 
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to