Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Dec 2015 23:10:19 +0200
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Ian Lepore <ian@freebsd.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r291937 - in head: lib/libc/aarch64/sys lib/libc/arm/sys sys/arm/arm sys/arm/include sys/arm64/arm64 sys/arm64/include sys/conf sys/kern
Message-ID:  <20151224211019.GD3625@kib.kiev.ua>
In-Reply-To: <1450988333.25138.261.camel@freebsd.org>
References:  <201512071220.tB7CKRw0027858@repo.freebsd.org> <1450971642.25138.247.camel@freebsd.org> <20151224180053.GY3625@kib.kiev.ua> <1450988333.25138.261.camel@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20151224211019.GD3625>