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]

Mark Millard markmi at dsl-only.net
Fri Sep 9 01:02:29 UTC 2016


[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:
> 
>> Thanks, this helps. The kernel may not need this, but in general 
>> soft-float needs to generate library calls for floating-point 
>> operations. Is there a library for those for powerpc64? The compiler 
>> will need to know at least the names and parameters of these functions.
>> 
>> -Krzysztof
> 
> http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20160523/159625.html for the recent enabling of adding soft-float for sparc says:
> 
>> The user should ensure a library (such as the builtins from Compiler-RT) that includes the software floating point routines is provided.
> 
> 
> 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.
> 
> Since TARGET_ARCH=powerpc has the soft-float support I looked in:
> 
> https://svnweb.freebsd.org/base/stable/11/contrib/compiler-rt/lib/builtins/ppc/
> 
> and see that it has:
> 
> 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
> 
> 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:
> 
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/ppc/
> 
> I do not know what would need to be different for TARGET_ARCH=powerpc64 .
> 

Interestingly http://compiler-rt.llvm.org says (mentioning powerpc64 explicitly):

[Quoting the web site this time.]

> Platform Support
> 
> builtins is known to work on the following platforms:
> 
> 	• Machine Architectures: i386, X86-64, SPARC64, ARM, PowerPC, PowerPC 64.
> 	• 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 = ppc::getPPCFloatABI(D, Args);
>   if (FloatABI == ppc::FloatABI::Soft &&
>       !(Triple.getArch() == llvm::Triple::ppc64 ||
>         Triple.getArch() == llvm::Triple::ppc64le))
>     Features.push_back("+soft-float");
>   else if (FloatABI == ppc::FloatABI::Soft &&
>            (Triple.getArch() == llvm::Triple::ppc64 ||
>             Triple.getArch() == llvm::Triple::ppc64le))
>     D.Diag(diag::err_drv_invalid_mfloat_abi) 
>         << "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=powerpc64 (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 
> 
> https://svnweb.freebsd.org/base/stable/11/contrib/compiler-rt/lib/builtins/sparc64/
> 
> has:
> 
> divmod.m4
> divsi3.S
> generate.sh
> modsi3.S
> udivsi3.S
> umodsi3.S
> 
> But there seems to be no match on llvm.org for these for sparc64. So sometimes FreeBSD does have unique material in compiler-rt.
> 
> As for more generic material common across architectures:
> 
> https://svnweb.freebsd.org/base/stable/11/contrib/compiler-rt/lib/builtins/
> 
> and (showing trunk again)
> 
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/
> 
> have more generic material, including more floating-point material. (I'll not list it all.)
> 
> 
> Side note:
> 
> Attempting to CC you on an earlier message got a non-delivery notice that said, in part:
> 
> Connected to mail3.swissmail.org:212.25.22.133 but recipient was rejected. STARTTLS proto=TLSv1; cipher=DHE-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
> 
> (There is a " at " replacement in the above that was not in the original.)
> 
> ===
> Mark Millard
> markmi at dsl-only.net



===
Mark Millard
markmi at dsl-only.net




More information about the freebsd-ppc mailing list