ARM programs expecting misspelt __ARM_ARCH_6ZK__

Peter Jeremy peter at rulingia.com
Sat Sep 21 08:17:13 UTC 2019


When GCC introduced support for the ARMv6KZ architecture, it misspelt it
as ARMv6ZK.  This only affects arm1176jz-s and arm1176jzf-s but,
unfortunately, this includes the BCM2835 as used in the RaspberryPi
Model 1.  This has been corrected in FreeBSD (see r312292 and
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216104) and GCC (see
https://gcc.gnu.org/ml/gcc-patches/2015-06/msg01679.html) and appears to
have never been present in Clang.

Unfortunately, it seems that various freeware still expects to find
__ARM_ARCH_6ZK__, rather than the correct __ARM_ARCH_6KZ__.  Within
FreeBSD-13, there are references to __ARM_ARCH_6ZK__ (only) in:
contrib/openmp/runtime/src/kmp_platform.h
contrib/subversion/subversion/libsvn_subr/lz4/lz4.c
crypto/openssl/crypto/arm_arch.h
sys/arm/include/acle-compat.h
sys/contrib/zstd/lib/legacy/zstd_v0?.c
sys/contrib/zstd/lib/common/xxhash.c
sys/contrib/zstd/lib/common/mem.h

In most cases, the incorrect definition just leads to poor code (because
the relevant model-specific optimisations aren't enabled) but some ports
are fussier: I discovered the problem because ports/security/libressl
won't build on my RPi since libressl refuses to build if it doesn't find
an __ARM_ARCH_.* definition that it likes.

Fixing FreeBSD base code is technically fairly easy.  Fixing every port
that potentially checks for __ARM_ARCH_6ZK__ is much harder (somewhat on
a par with fixing the assumption that FreeBSD-1* is a.out, not ELF).  I
had a quick check through my ports distfiles and __ARM_ARCH_6ZK__ is
referenced more often than I'd expect.

The options for ports would seem to be:
1) Hack clang to export __ARM_ARCH_6ZK__ as well as __ARM_ARCH_6KZ__
2) Expect every port maintainer to fix subtle misbehavour on the RPi1
   by adding appropriate patches.
3) When building on ARM, run a sed script that fixes any occurrences
   of __ARM_ARCH_6ZK__.

-- 
Peter Jeremy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 963 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-arm/attachments/20190921/e1171414/attachment.sig>


More information about the freebsd-arm mailing list