From owner-freebsd-arm@freebsd.org Mon Sep 23 20:31:08 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 BEFC0FF01B for ; Mon, 23 Sep 2019 20:31:08 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound2m.ore.mailhop.org (outbound2m.ore.mailhop.org [54.149.155.156]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46cbZ42gbCz4TlL for ; Mon, 23 Sep 2019 20:31:08 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1569270666; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=OzPKApvWm6R8kmLqMmwOF2Q6Dp+jhTmiXCKE6x7/OGCD8gA6Vs3ug1xPJi0ZkeaozEIvzTRdr/SN8 l11bKq+yZMdvJ77+rHhCjrCTrvZnX3bkZdVVP2pWD/O3P1Iqdt0+eYdib264SOFHZIcq+Q1OPHW1fy V3GVncCZYoNuDMVpDuQchiLki/XnBb7+Klj1VFviGep7uKZp1uZu6i6z7KjUOBhQDlassdOodownb2 L/DAlhECcqvfvLhvBEiJJazSM+csNhOcJt0ggEw1n9XZ6fdQ2B1dyjmcxey9sH5/lXQsyIkKJIJQL5 BfBkfIVYU0XRKJlxUXrxj+YXzjhi6gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:dkim-signature:from; bh=Mn5VXLO1XltAU1EKael8T64PxteXUJKnVAXe0TSsLXo=; b=ERX2lMoocVl7MlrTfBoqAeae/tm8FZ6mBbNurqb7KlG/cxMliOa3Yyxt0l/6QcGU6LGQQ1wtEmeKz kLIJ/IDbf8bO7soBkZANifKIh3L4en8MhJiRf4pahip2CL0jdiMIgiOGaiHvT/kgiI25BbHCKvgnfq jj1ns0lOyNRdd4hyHYddAb9NE4onxaH6NXVJP2TjSZOraYO/F/edNztdJucRD8pJkv811vVKq8ipk2 E8cWb/xvjcbr6Mn308w1HQeNL6EDtufuYbeTVSjQEW7AuGZIF/urQu+zZMqdtKQK7MObeFi/uAQuZH 0z77nglLX3ClD+JR7dS7FliM4B9RdEA== ARC-Authentication-Results: i=1; outbound4.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:from; bh=Mn5VXLO1XltAU1EKael8T64PxteXUJKnVAXe0TSsLXo=; b=NWdzSXdjQ50byKzb1wZrehj3GS+pFeCcaP2lQDudm4Xpd3zUVg33VrNrIYLESIxpxiWNuodoYlpR5 S8fDXKHJvhW6IbD2shySRubqgyTriDBoobD/UOCpv6Nu7rXJMTm0B2phia7gf1sbZ8YjZOB0OQb72t VsPWIuRUwE7ECOgUCujNkkQzqMih/hu1drb3gTBz9QuqBiTdy3+AHxatuWDKSp5Zw+Rf0N9tteVP5F 2W7Gj6exzJf+8XMusji+bBdi0ft8Xumoa/pTACSQKFmECppm//Z/0jmmFBZTdyeygwtrzx/+CceJxB S8bVIZyjGppWh84VBhueOxCqT3pj7eQ== X-MHO-RoutePath: aGlwcGll X-MHO-User: 0f414aa5-de41-11e9-85ed-13b9aae3a1d2 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound4.ore.mailhop.org (Halon) with ESMTPSA id 0f414aa5-de41-11e9-85ed-13b9aae3a1d2; Mon, 23 Sep 2019 20:31:04 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id x8NKV12x024874; Mon, 23 Sep 2019 14:31:01 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <7e88e9e6280b81ae1327389fdd1f8298007df493.camel@freebsd.org> Subject: Re: ARM programs expecting misspelt __ARM_ARCH_6ZK__ From: Ian Lepore To: Warner Losh , Peter Jeremy Cc: freebsd-arm@freebsd.org Date: Mon, 23 Sep 2019 14:31:01 -0600 In-Reply-To: References: <20190921081649.GM97181@server.rulingia.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46cbZ42gbCz4TlL X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.97 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.97)[-0.967,0]; ASN(0.00)[asn:16509, ipnet:54.148.0.0/15, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] 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: Mon, 23 Sep 2019 20:31:08 -0000 On Sat, 2019-09-21 at 11:55 +0200, Warner Losh wrote: > 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 When gcc fixed the problem, they added the correct spelling and left the incorrect one in place for the predefined symbol. They also made both spellings be accepted on the command line -march= arg. I think that's the only sensible thing for clang to do as well. A datapoint that supports the idea that the misspelled version is an API cast in stone for all time is that the acle-compat.h file distributed by ARM uses the original GCC misspelled version, and ARM has never updated that file to support both spellings; they seem to expect the bad spelling to be supported forever. -- Ian