2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 22:15:20 +00:00

Merge branch '612-problems-compiling-on-arm-processor' into 'master'

Resolve "Problems compiling on arm processor"

Closes #612

See merge request isc-projects/bind9!869
This commit is contained in:
Ondřej Surý
2018-10-23 03:46:33 -04:00
4 changed files with 77 additions and 1 deletions

View File

@@ -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
```

31
configure vendored
View File

@@ -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"

View File

@@ -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])
#

View File

@@ -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")