From owner-freebsd-ppc@freebsd.org Fri Sep 9 01:02:29 2016 Return-Path: Delivered-To: freebsd-ppc@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 359F1BD201E for ; Fri, 9 Sep 2016 01:02:29 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: from asp.reflexion.net (outbound-mail-210-42.reflexion.net [208.70.210.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EF4B565D for ; Fri, 9 Sep 2016 01:02:28 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: (qmail 30903 invoked from network); 9 Sep 2016 01:03:11 -0000 Received: from unknown (HELO mail-cs-01.app.dca.reflexion.local) (10.81.19.1) by 0 (rfx-qmail) with SMTP; 9 Sep 2016 01:03:11 -0000 Received: by mail-cs-01.app.dca.reflexion.local (Reflexion email security v8.00.0) with SMTP; Thu, 08 Sep 2016 21:02:30 -0400 (EDT) Received: (qmail 5099 invoked from network); 9 Sep 2016 01:02:29 -0000 Received: from unknown (HELO iron2.pdx.net) (69.64.224.71) by 0 (rfx-qmail) with (AES256-SHA encrypted) SMTP; 9 Sep 2016 01:02:29 -0000 Received: from [192.168.0.104] (ip70-189-131-151.lv.lv.cox.net [70.189.131.151]) by iron2.pdx.net (Postfix) with ESMTPSA id 0777BEC9049 for ; Thu, 8 Sep 2016 18:02:24 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: From llvm: Fwd: [Bug 26519] Clang 3.8.0's "Target: powerpc-unknown-freebsd11.0" code generation is violating the SVR4 ABI (SEGV can result) [fixed in llvm -r280705] From: Mark Millard In-Reply-To: Date: Thu, 8 Sep 2016 18:02:24 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <6EA51424-C360-4604-B2D5-06C6762600A9@dsl-only.net> References: To: FreeBSD PowerPC ML X-Mailer: Apple Mail (2.3124) X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Sep 2016 01:02:29 -0000 [A few compiler-rt notes added: not obvious why "soft float is not = supported for ppc64" in clang . . .] On 2016-Sep-8, at 12:37 PM, Mark Millard wrote: > Krzysztof Parzyszek kristof at swissmail.org on Thu Sep 8 13:01:44 UTC = 2016 wrote: >=20 >> Thanks, this helps. The kernel may not need this, but in general=20 >> soft-float needs to generate library calls for floating-point=20 >> operations. Is there a library for those for powerpc64? The compiler=20= >> will need to know at least the names and parameters of these = functions. >>=20 >> -Krzysztof >=20 > = http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20160523/159625.ht= ml for the recent enabling of adding soft-float for sparc says: >=20 >> The user should ensure a library (such as the builtins from = Compiler-RT) that includes the software floating point routines is = provided. >=20 >=20 > As I read this it appears that the library has to match the compiler, = instead of the compiler being made to match the library --and at least = sometimes compiler-rt has that matching material. >=20 > Since TARGET_ARCH=3Dpowerpc has the soft-float support I looked in: >=20 > = https://svnweb.freebsd.org/base/stable/11/contrib/compiler-rt/lib/builtins= /ppc/ >=20 > and see that it has: >=20 > DD.h > divtc3.c > fixrfdi.c > floatunstfdi.c > floatditf.c > floatunditf.c > gcc_qadd.c > gcc_qdiv.c > gcc_qmul.c > gcc_qsub.c > multc3.c > restFP.S > saveFP.S >=20 > Note that FreeBSD is not the originator of compiler-rt. Instead = FreeBSD takes compiler-rt in from outside: the above is from some = variant/version of what is for truck visible at: >=20 > = http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/ppc/ >=20 > I do not know what would need to be different for = TARGET_ARCH=3Dpowerpc64 . >=20 Interestingly http://compiler-rt.llvm.org says (mentioning powerpc64 = explicitly): [Quoting the web site this time.] > Platform Support >=20 > builtins is known to work on the following platforms: >=20 > =E2=80=A2 Machine Architectures: i386, X86-64, SPARC64, ARM, = PowerPC, PowerPC 64. > =E2=80=A2 OS: AuroraUX, DragonFlyBSD, FreeBSD, NetBSD, Linux, = Darwin. If true for all builtins (libgcc like) for powerpc64 then I'm not sure = why there is the code: [Quoting from https://reviews.llvm.org/D13351 and its = cfe/trunk/lib/Driver/Tools.cpp material this time.] > ppc::FloatABI FloatABI =3D ppc::getPPCFloatABI(D, Args); > if (FloatABI =3D=3D ppc::FloatABI::Soft && > !(Triple.getArch() =3D=3D llvm::Triple::ppc64 || > Triple.getArch() =3D=3D llvm::Triple::ppc64le)) > Features.push_back("+soft-float"); > else if (FloatABI =3D=3D ppc::FloatABI::Soft && > (Triple.getArch() =3D=3D llvm::Triple::ppc64 || > Triple.getArch() =3D=3D llvm::Triple::ppc64le)) > D.Diag(diag::err_drv_invalid_mfloat_abi)=20 > << "soft float is not supported for ppc64"; The above reports that "soft float is not supported for ppc64". This = notice seems to be global for clang powerpc64: in no way FreeBSD = specific. May be the view is that no floating point builtins ever apply to = powerpc64 (but they do for powerpc (32))? FreeBSD might use its libgcc instead of compiler-rt for = TARGET_ARCH=3Dpowerpc64 (I've not checked). But the clang/clang++ compiler seems to be based on never having a = floating-point builtins library for soft-float on powerpc64 at all. I've = no clue why. [Back to normal quoting.] > By contrast=20 >=20 > = https://svnweb.freebsd.org/base/stable/11/contrib/compiler-rt/lib/builtins= /sparc64/ >=20 > has: >=20 > divmod.m4 > divsi3.S > generate.sh > modsi3.S > udivsi3.S > umodsi3.S >=20 > But there seems to be no match on llvm.org for these for sparc64. So = sometimes FreeBSD does have unique material in compiler-rt. >=20 > As for more generic material common across architectures: >=20 > = https://svnweb.freebsd.org/base/stable/11/contrib/compiler-rt/lib/builtins= / >=20 > and (showing trunk again) >=20 > http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/ >=20 > have more generic material, including more floating-point material. = (I'll not list it all.) >=20 >=20 > Side note: >=20 > Attempting to CC you on an earlier message got a non-delivery notice = that said, in part: >=20 > Connected to mail3.swissmail.org:212.25.22.133 but recipient was = rejected. STARTTLS proto=3DTLSv1; cipher=3DDHE-RSA-AES256-SHA. > Remote host said: 450 4.2.0 : Recipient = address rejected: Greylisted, see = http://postgrey.schweikert.ch/help/swissmail.org.html >=20 > (There is a " at " replacement in the above that was not in the = original.) >=20 > =3D=3D=3D > Mark Millard > markmi at dsl-only.net =3D=3D=3D Mark Millard markmi at dsl-only.net