From owner-freebsd-hackers@freebsd.org Sun Oct 29 00:54:36 2017 Return-Path: Delivered-To: freebsd-hackers@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 A55EBE52F2F for ; Sun, 29 Oct 2017 00:54:36 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: from asp.reflexion.net (outbound-mail-210-119.reflexion.net [208.70.210.119]) (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 467032F39 for ; Sun, 29 Oct 2017 00:54:35 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: (qmail 14396 invoked from network); 29 Oct 2017 00:54:29 -0000 Received: from unknown (HELO rtc-sm-01.app.dca.reflexion.local) (10.81.150.1) by 0 (rfx-qmail) with SMTP; 29 Oct 2017 00:54:29 -0000 Received: by rtc-sm-01.app.dca.reflexion.local (Reflexion email security v8.40.3) with SMTP; Sat, 28 Oct 2017 20:54:29 -0400 (EDT) Received: (qmail 6974 invoked from network); 29 Oct 2017 00:54:29 -0000 Received: from unknown (HELO iron2.pdx.net) (69.64.224.71) by 0 (rfx-qmail) with (AES256-SHA encrypted) SMTP; 29 Oct 2017 00:54:29 -0000 Received: from [192.168.1.25] (c-76-115-7-162.hsd1.or.comcast.net [76.115.7.162]) by iron2.pdx.net (Postfix) with ESMTPSA id 77492EC8676; Sat, 28 Oct 2017 17:54:28 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: Question for powerpc64 lib32 (powerpc) support: what ABI is the powerpc code supposed to be using? From: Mark Millard In-Reply-To: Date: Sat, 28 Oct 2017 17:54:27 -0700 Cc: FreeBSD PowerPC ML , freebsd-hackers Content-Transfer-Encoding: quoted-printable Message-Id: <299784B1-55F3-4C39-B07B-CE6C9E9BB2A8@dsl-only.net> References: <618F5419-0BB7-496E-B1B8-DA8BE6D54A58@dsl-only.net> To: Justin Hibbits X-Mailer: Apple Mail (2.3273) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Oct 2017 00:54:36 -0000 Hello Justin > On 2017-Oct-28, at 5:03 PM, Justin Hibbits = wrote: >=20 >> On Oct 28, 2017 17:08, "Mark Millard" wrote: >> powerpc64 and powerpc have very different stack handling >> rules for FreeBSD. As an example, powerpc does not require >> red-zones for signal handling in the kernel but powerpc64 >> does. >>=20 >> For lib32 support, what ABI is the powerpc code supposed >> to follow in the powerpc64 environment? What style of >> stack handling (and related register usage) is supposed >> to be in use? If it is distinct from powerpc native's >> ABI, what documentation should be looked at for the ABI? >=20 > PowerPC via lib32 should be using the 32-bit svr4 ABI. If you see any = discrepancy in that, it's a bug that needs fixed. Then I expect that the reason that devel/powerpc64-gcc based buildworld's make a lib32 that fails in code that is from /usr/lib32/crtbeginS.o is because /usr/lib32/crtbeginS.o ends up not having the right ABI involved and, so, misuses at least one register. (I've not worked out if there is any special transition from one ABI to the other (and later back) that is needed vs. not. But the red-zoning for powerpc64 should be more than sufficient for powerpc code that does not require it.) An interesting point is: (all on a powerpc64 FreeBSD head -r324071 system) # clang -dumpmachine -m32 powerpc-unknown-freebsd12.0 # /usr/local/bin/powerpc64-unknown-freebsd12.0-gcc -dumpmachine -m32 powerpc64-unknown-freebsd12.0 # gcc7 -dumpmachine -m32 powerpc64-portbld-freebsd12.0 # clang -dumpmachine powerpc64-unknown-freebsd12.0 # /usr/local/bin/powerpc64-unknown-freebsd12.0-gcc -dumpmachine powerpc64-unknown-freebsd12.0 # gcc7 -dumpmachine powerpc64-portbld-freebsd12.0 (But I'm not sure that these always reflect ABI variations in code generated.) I wonder if for gcc it takes a separate compiler to have powerpc-unknown-freebsd12.0 (intending to imply the FreeBSD 32-bit ABI is in use). bugzilla 206123 should probably have notes added about the probable ABI mismatch in /usr/lib32/crtbeginS.o. I may add this whole message but someone with better background information may able to submit more specific material. At this point I do not know how to control what ABI code is generated by devel/powerpc64-gcc in what becomes /usr/lib32/crtbeginS.o (or how other code interfaces with crtbeginS.o code). Its been a long time since I tried other gcc variations but all of them had the issue when I did try. =3D=3D=3D Mark Millard markmi at dsl-only.net