Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Sep 2019 18:16:49 +1000
From:      Peter Jeremy <peter@rulingia.com>
To:        freebsd-arm@freebsd.org
Subject:   ARM programs expecting misspelt __ARM_ARCH_6ZK__
Message-ID:  <20190921081649.GM97181@server.rulingia.com>

next in thread | raw e-mail | index | archive | help

--xQR6quUbZ63TTuTU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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=3D216104) 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__.

--=20
Peter Jeremy

--xQR6quUbZ63TTuTU
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEE7rKYbDBnHnTmXCJ+FqWXoOSiCzQFAl2F3GtfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEVF
QjI5ODZDMzA2NzFFNzRFNjVDMjI3RTE2QTU5N0EwRTRBMjBCMzQACgkQFqWXoOSi
CzRciQ//UyI1ByXjdSABY+EiT4wJvXAn1V4gXnkX1kmdfEbPMlolGOJfKnL66Uf9
pMo6gECRUkvQxiooF5pJIIqv/vGJHUtQjL1J1ZQp5vWrBCuBr54XhXoCcn4fJtoy
lRrZaMSOv58UQpNy48wa8PtOp05AtqgOZ964TLk+8L1jW8oQ944E/m4yD5tf8w0U
r1ACg3kut6cja4chg+ejDjyARjDC+NBTZfyF+QYLlVms6L299rLPhz6j+H2ZmKC+
5P/QECftOt6U7XYwrueK9h4uBDFvfHVWoLSBCMqgcVREQX0j93qCdu2QRigAV82/
P9pWHgTli2DW1jyFXnJXJph6P3am/endCUnxJUJ7C4Moge6Ykc2GPhKrtGAMYT36
ZndCMxGzNRkzVxeunf2heZu8g3UbKrHtSTc3Eplt2zSiwQcBSKVwDmr6u8bmzuYd
FLwOSvYac4KoSfNGpnBwxCUvnYQLv/+UbGBEs8YtI9h7sbKk+ukNvpr40f21MOxc
pYO/bz1FSxAmzbsp25j2OM6/XXAbYRdmdrzvk53iQclUATqvAPZvpPPPrAWydv1A
VzP6MOoVvdKFM2Li5VG3pXTfSQWvjCTjs/5sC3wAzjX9xag80NdjXkYBBaVAktwY
2fWibufZD8CQiV98MDTe0+jQHazyqN4MD8ME9KXB6uaQOopEbK8=
=LkkM
-----END PGP SIGNATURE-----

--xQR6quUbZ63TTuTU--



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