Date: Sat, 28 Oct 2017 17:54:27 -0700 From: Mark Millard <markmi@dsl-only.net> To: Justin Hibbits <chmeeedalf@gmail.com> Cc: FreeBSD PowerPC ML <freebsd-ppc@freebsd.org>, freebsd-hackers <freebsd-hackers@freebsd.org> Subject: Re: Question for powerpc64 lib32 (powerpc) support: what ABI is the powerpc code supposed to be using? Message-ID: <299784B1-55F3-4C39-B07B-CE6C9E9BB2A8@dsl-only.net> In-Reply-To: <CAHSQbTD8RGw6FBA0Uz2vrgOndJcvuLQZjTe_rsOSmqf9UMca=g@mail.gmail.com> References: <618F5419-0BB7-496E-B1B8-DA8BE6D54A58@dsl-only.net> <CAHSQbTD8RGw6FBA0Uz2vrgOndJcvuLQZjTe_rsOSmqf9UMca=g@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Hello Justin > On 2017-Oct-28, at 5:03 PM, Justin Hibbits <chmeeedalf at gmail.com> = wrote: >=20 >> On Oct 28, 2017 17:08, "Mark Millard" <markmi at dsl-only.net> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?299784B1-55F3-4C39-B07B-CE6C9E9BB2A8>