Clang problems with Solaris and SPARC

Hi Witold,

This appears to be a bug in Clang. The offending code is in lib/Driver/Tools.cpp:

if (FloatABI == “soft”) {
// Floating point operations and argument passing are soft.
//
// FIXME: This changes CPP defines, we need -target-soft-float.
CmdArgs.push_back("-msoft-float");
CmdArgs.push_back(“soft”);
CmdArgs.push_back("-target-feature");
CmdArgs.push_back("+soft-float");
} else {

but –msoft-float is defined in CC1Options.td as:

def msoft_float : Flag<"-msoft-float">,
HelpText<“Use software floating point”>;

i.e. it doesn’t take an argument. So Clang (as cc1) is interpreting the extra ‘soft’ argument as an input file.

Fix is to remove the line “CmdArgs.push_back(“soft”);” as far as I can tell?

Cheers,

James

Hi James,

Your fix is working for me. Thanks a lot. The new issue is that now clang displays following message:
$ ./clang++ ~/q.cpp -o ~/q
clang-2: warning: unknown platform, assuming -mfloat-abi=soft
‘+soft-float’ is not a recognized feature for this target (ignoring feature)

I would assume that if soft-float is not recognized for this target (ie. sparc) a hardware floating point operations should be used in first place and we shouldn’t even try to use soft-float. Do you know what is the status of sparc target support? Does it support floating point operations or not?

Cheers!
Witek

2011/5/25 James Molloy <james@jamesmolloy.co.uk>

Hi,

[Forgot to reply-all]

Looking at Tools.cpp:AddSPARCTargetArgs(), it looks like the softfloat behaviour has been copy-pasted from another architecture’s TargetArgs (notice the switch only has a default case?).

I don’t know anything about SPARC so would not be able to say what the default behaviour should be - perhaps someone else could weigh in on that point?

Cheers,

James