Problems compiling on arm processor
Summary
Compiling on arm processor stops with error message
BIND version used
Latest version running:
$ named -V
BIND 9.13.3-dev (Development Release) <id:760182271e>
running on Linux armv7l 4.14.70-v7+ #1144 SMP Tue Sep 18 17:34:46 BST 2018
built by make with '--enable-getifaddrs' '--with-python' '--with-libxml2' '--disable-linux-caps'
compiled by GCC 6.3.0 20170516
compiled with OpenSSL version: OpenSSL 1.1.0f 25 May 2017
linked to OpenSSL version: OpenSSL 1.1.0f 25 May 2017
compiled with libxml2 version: 2.9.4
linked to libxml2 version: 20904
compiled with zlib version: 1.2.8
linked to zlib version: 1.2.8
threads support is enabled
Steps to reproduce
Try to compile on arm processor (raspberry pi).
What is the current bug behavior?
Compilations stops with error message:
gcc -I.../git/bind9 -I../.. -I./unix/include -I./pthreads/include -I./include -I./include -I.../git/bind9/lib/dns/include -I../../lib/dns/include -I/usr/include -g -O2 -pthread -I/usr/include/libxml2 -fPIC -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith -fno-strict-aliasing -fno-delete-null-pointer-checks -c rwlock.c
/tmp/cc92tnx7.s: Assembler messages:
/tmp/cc92tnx7.s:671: Error: selected processor does not support `yield' in ARM mode
Makefile:273: recipe for target 'rwlock.o' failed
make[2]: *** [rwlock.o] Error 1
make[2]: Leaving directory '.../git/bind9/lib/isc'
Makefile:82: recipe for target 'subdirs' failed
make[1]: *** [subdirs] Error 1
make[1]: Leaving directory '.../git/bind9/lib'
Makefile:89: recipe for target 'subdirs' failed
make: *** [subdirs] Error 1
Possible fixes
My guess is that the following commit introduced or modified isc_rwlock_lock()
$ git diff 376bea8b40bbf64954 lib/isc/rwlock.c
diff --git a/lib/isc/rwlock.c b/lib/isc/rwlock.c
index 622cd7d276..91482e6c64 100644
--- a/lib/isc/rwlock.c
+++ b/lib/isc/rwlock.c
@@ -41,6 +41,25 @@
#define RWLOCK_MAX_ADAPTIVE_COUNT 100
#endif
+#if defined(_MSC_VER)
+# include <intrin.h>
+# define isc_rwlock_pause() YieldProcessor()
+#elif defined(__x86_64__) || defined(__i386__)
+# include <immintrin.h>
+# define isc_rwlock_pause() _mm_pause()
+#elif defined(__ia64__)
+# define isc_rwlock_pause() __asm__ __volatile__ ("hint @pause")
+#elif defined(__arm__)
+# define isc_rwlock_pause() __asm__ __volatile__ ("yield")
+#elif defined(__sparc) || defined(__sparc__)
+# define plasma_spin_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")
+#else
+# define isc_rwlock_pause()
+#endif
+
static isc_result_t
isc__rwlock_lock(isc_rwlock_t *rwl, isc_rwlocktype_t type);
@@ -350,9 +369,7 @@ isc_rwlock_lock(isc_rwlock_t *rwl, isc_rwlocktype_t
type) {
result = isc__rwlock_lock(rwl, type);
break;
}
-#ifdef ISC_PLATFORM_BUSYWAITNOP
- ISC_PLATFORM_BUSYWAITNOP;
-#endif
+ isc_rwlock_pause();
} while (isc_rwlock_trylock(rwl, type) != ISC_R_SUCCESS);
Edited by Ondřej Surý