From owner-freebsd-arm@freebsd.org Sat Sep 21 09:55:30 2019 Return-Path: Delivered-To: freebsd-arm@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4B068FDA5F for ; Sat, 21 Sep 2019 09:55:30 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x729.google.com (mail-qk1-x729.google.com [IPv6:2607:f8b0:4864:20::729]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46b5YY3DGGz4LL5 for ; Sat, 21 Sep 2019 09:55:29 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x729.google.com with SMTP id u184so10013015qkd.4 for ; Sat, 21 Sep 2019 02:55:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=yC2PaIGu6XK07LnvnwhzLSUxgkL/cSsPBmFp1fp0ie8=; b=fGJS6eW9kLAkxcftB1uLYZdKdFlb7X8qgQhW/qYlCSjXkUk5v12fL4sliRLTZnU+lW VMwKL/mo7OWjZchcunWECEazlW1NYHLebyZPhIDUYZL6WxmDTuwl+2jeBlJ1TkXmwBP1 qwfFOEDIyplMI2dqA/PllawxULD9s0xnNXgsKhh9TiaisQfFuR2CMjAoH0zvlkkhA6HQ T5Vd9K4B8I/x2tJYFUChxI/ZrxuqypuAFl4SrlQ5SUcKkAN6vkET3WFKot3bgs9aRH2b PUuQBo1tT8M6Wy7mOeKH57ZfKuR/m2WC3sAwqaBRJOl7fO/iEG1tJ3D3eP9yxJ7lJ+2+ 1Y4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=yC2PaIGu6XK07LnvnwhzLSUxgkL/cSsPBmFp1fp0ie8=; b=IWC4bk44GhXAEKpXdGAphwTl2x1lZdl+fTkAmzgVu1bDkB+9Fyfks4w4HmaxCVzCQ7 zrxOrSjM0Yu8Q3peG0YR1wLADX4Z+NCDLQC4stOnXkg0terQAd/hI/fQjf8mNoJ9Mw4j lkBE0SoW5kmB2DIxT9ghg+5maBrxpjV+DoK/hupRoAGtfCNwvQt3X6ntpWcakF3GidGr OdIIcZjM2kSaqv9YiNs2sfPFfhU8ztGTx2jXWfdnpYMoiuAT3IUqAyjOAevWQi/MZtvL Cv7a8aeLFdtE+Tq6QL3AsdZB37qgZeSTcUQJwW91j2wqa47fe4t4cXBiKi8DewTjD/C/ Uu1g== X-Gm-Message-State: APjAAAWrjpDMWxEK5HEILL2vszlWVlmUyXMRTp6NUyY9BBOLw3eVIVXl 8tEAoaTOnO4OKGYlPr5HhS7qrdqzeC3oabjO5myBPrAJHOQ= X-Google-Smtp-Source: APXvYqxB1VGpuW0kZgaHsMdS9xDxKneYNEzgoyU6ltfEDk5ll3KcAUWR37+KShXdb8pEIq6IxsVdKqqUXEaSosEwP20= X-Received: by 2002:a05:620a:12b6:: with SMTP id x22mr7933798qki.495.1569059727636; Sat, 21 Sep 2019 02:55:27 -0700 (PDT) MIME-Version: 1.0 References: <20190921081649.GM97181@server.rulingia.com> In-Reply-To: <20190921081649.GM97181@server.rulingia.com> From: Warner Losh Date: Sat, 21 Sep 2019 11:55:15 +0200 Message-ID: Subject: Re: ARM programs expecting misspelt __ARM_ARCH_6ZK__ To: Peter Jeremy Cc: freebsd-arm@freebsd.org X-Rspamd-Queue-Id: 46b5YY3DGGz4LL5 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=fGJS6eW9; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::729) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-4.84 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-arm@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[9.2.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.84)[ip: (-9.28), ipnet: 2607:f8b0::/32(-2.65), asn: 15169(-2.20), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Sep 2019 09:55:30 -0000 On Sat, Sep 21, 2019, 10:17 AM Peter Jeremy wrote: > 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__. > I'd prefer #1. Or a 1a that defines the bad one if the good one is defined in some appropriate system header. It has become a defacto API... Warner -- > Peter Jeremy >