diff --git a/PLATFORMS.md b/PLATFORMS.md index 840af14b34..1b2ca1f9cd 100644 --- a/PLATFORMS.md +++ b/PLATFORMS.md @@ -67,3 +67,34 @@ These are platforms on which BIND is known *not* to build or run: * Platforms that don't support IPv6 Advanced Socket API (RFC 3542) * Platforms that don't support atomic operations (via compiler or library) * Linux without NPTL (Native POSIX Thread Library) + +## Platform quirks + +### ARM + +If the compilation ends with following error: + +``` +Error: selected processor does not support `yield' in ARM mode +``` + +You will need to set `-march` compiler option to `native`, so the compiler +recognizes `yield` assembler instruction. The proper way to set `-march=native` +would be to put it into `CFLAGS`, e.g. run `./configure` like this: +`CFLAGS="-march=native -Os -g" ./configure` plus your usual options. + +If that doesn't work, you can enforce the minimum CPU and FPU (taken from Debian +armhf documentation): + +* The lowest worthwhile CPU implementation is Armv7-A, therefore the recommended + build option is `-march=armv7-a`. + +* FPU should be set at VFPv3-D16 as they represent the miminum specification of + the processors to support here, therefore the recommended build option is + `-mfpu=vfpv3-d16`. + +The configure command should look like this: + +``` +CFLAGS="-march=armv7-a -mfpu=vfpv3-d16 -Os -g" ./configure +``` diff --git a/configure b/configure index 05ed9a2412..efbe6855fc 100755 --- a/configure +++ b/configure @@ -13618,6 +13618,37 @@ $as_echo "#define FLEXIBLE_ARRAY_MEMBER /**/" >>confdefs.h fi +# +# Check for yield support on ARM processors +# +case $host in #( + arm*) : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for yield instruction support" >&5 +$as_echo_n "checking for yield instruction support... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +__asm__ __volatile__ ("yield") + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + as_fn_error $? "no, try adding -march=native or -march=armv7-a to CFLAGS (see PLATFORM.md for more information)" "$LINENO" 5 +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ;; #( + *) : + ;; +esac + for ac_func in sysctlbyname do : ac_fn_c_check_func "$LINENO" "sysctlbyname" "ac_cv_func_sysctlbyname" diff --git a/configure.in b/configure.in index e26918d20d..914e5ae2c1 100644 --- a/configure.in +++ b/configure.in @@ -460,6 +460,20 @@ AC_C_INLINE AC_C_VOLATILE AC_C_FLEXIBLE_ARRAY_MEMBER +# +# Check for yield support on ARM processors +# +AS_CASE([$host], + [arm*],[ + AC_MSG_CHECKING([for yield instruction support]) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[]], + [[__asm__ __volatile__ ("yield")]] + )], + [AC_MSG_RESULT([yes])], + [AC_MSG_ERROR([no, try adding -march=native or -march=armv7-a to CFLAGS (see PLATFORM.md for more information)])])]) + AC_CHECK_FUNCS([sysctlbyname]) # diff --git a/lib/isc/rwlock.c b/lib/isc/rwlock.c index 91482e6c64..8e4a94108b 100644 --- a/lib/isc/rwlock.c +++ b/lib/isc/rwlock.c @@ -52,7 +52,7 @@ #elif defined(__arm__) # define isc_rwlock_pause() __asm__ __volatile__ ("yield") #elif defined(__sparc) || defined(__sparc__) -# define plasma_spin_pause() __asm__ __volatile__ ("pause") +# define isc_rwlock_pause() __asm__ __volatile__ ("pause") #elif defined(__ppc__) || defined(_ARCH_PPC) || \ defined(_ARCH_PWR) || defined(_ARCH_PWR2) || defined(_POWER) # define isc_rwlock_pause() __asm__ volatile ("or 27,27,27")