diff options
author | Abdoulaye Walsimou Gaye <awg@embtoolkit.org> | 2012-12-31 13:48:28 +0100 |
---|---|---|
committer | Abdoulaye Walsimou Gaye <awg@embtoolkit.org> | 2012-12-31 13:51:58 +0100 |
commit | ce031f044ce44c8ad0277d69f70fecdbc32f077b (patch) | |
tree | e7bf64b86d652571da547c141fa58d591184f8fa | |
parent | a178651ed6d2c76028a402eaa046d94b4fd5c83c (diff) | |
download | clang-ce031f044ce44c8ad0277d69f70fecdbc32f077b.tar.gz clang-ce031f044ce44c8ad0277d69f70fecdbc32f077b.tar.bz2 clang-ce031f044ce44c8ad0277d69f70fecdbc32f077b.tar.xz |
[Embtk] ARM: hard float: take into account default configured FPU if no -mfpu speecified
In case of hard floating point without -mfpu, take into account default configured
FPU if any.
And if no FPU is selected at all use vfp by default.
Signed-off-by: Abdoulaye Walsimou Gaye <awg@embtoolkit.org>
-rw-r--r-- | lib/Driver/Tools.cpp | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index b3f76f72da..a91f78315e 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -573,7 +573,21 @@ static bool isSignedCharDefault(const llvm::Triple &Triple) { // frontend target. static void addFPUArgs(const Driver &D, const Arg *A, const ArgList &Args, ArgStringList &CmdArgs) { - StringRef FPU = A->getValue(); + + std::string DefaultFPU; +#ifdef DEFAULT_TARGET_FPU + bool useDefaultFPU = true; + DefaultFPU = std::string(DEFAULT_TARGET_FPU); +#else + bool useDefaultFPU = false; +#endif + StringRef FPU; + + if (A) { + FPU = A->getValue(); + } else if (useDefaultFPU) { + FPU = DefaultFPU; + } // Set the target features based on the FPU. if (FPU == "fpa" || FPU == "fpe2" || FPU == "fpe3" || FPU == "maverick") { @@ -604,8 +618,15 @@ static void addFPUArgs(const Driver &D, const Arg *A, const ArgList &Args, } else if (FPU == "neon") { CmdArgs.push_back("-target-feature"); CmdArgs.push_back("+neon"); - } else + } else if (!FPU.empty()) D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args); + else { + // Hard floating point while no fpu selected, defaulting to vfp + CmdArgs.push_back("-target-feature"); + CmdArgs.push_back("+vfp2"); + CmdArgs.push_back("-target-feature"); + CmdArgs.push_back("-neon"); + } } // Handle -mfpmath=. @@ -797,9 +818,11 @@ void Clang::AddARMTargetArgs(const ArgList &Args, CmdArgs.push_back("+soft-float-abi"); } - // Honor -mfpu=. - if (const Arg *A = Args.getLastArg(options::OPT_mfpu_EQ)) - addFPUArgs(D, A, Args, CmdArgs); + // Honor -mfpu=. + if (const Arg *A = Args.getLastArg(options::OPT_mfpu_EQ)) + addFPUArgs(D, A, Args, CmdArgs); + else if (FloatABI == "hard" || FloatABI == "softfp") + addFPUArgs(D, NULL, Args, CmdArgs); // Honor -mfpmath=. if (const Arg *A = Args.getLastArg(options::OPT_mfpmath_EQ)) |