Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Sep 2016 18:02:24 -0700
From:      Mark Millard <markmi@dsl-only.net>
To:        FreeBSD PowerPC ML <freebsd-ppc@freebsd.org>
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]
Message-ID:  <6EA51424-C360-4604-B2D5-06C6762600A9@dsl-only.net>
In-Reply-To: <EB82D9DC-4868-4075-B02E-BEC3A241C9A9@dsl-only.net>
References:  <EB82D9DC-4868-4075-B02E-BEC3A241C9A9@dsl-only.net>

next in thread | previous in thread | raw e-mail | index | archive | help
[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 <markmi at dsl-only.net> 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 <kristof at swissmail.org>: 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





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6EA51424-C360-4604-B2D5-06C6762600A9>