Don't pass +soft-float, +soft-float-abi to the arm assembler.

llvm-svn: 195551
This commit is contained in:
Rafael Espindola 2013-11-23 14:36:40 +00:00
parent 4bf0d80993
commit 9c6fb0f784
2 changed files with 31 additions and 14 deletions

View File

@ -778,18 +778,30 @@ static StringRef getARMFloatABI(const Driver &D,
static void getARMTargetFeatures(const Driver &D, const llvm::Triple &Triple,
const ArgList &Args,
std::vector<const char *> &Features) {
std::vector<const char *> &Features,
bool ForAS) {
StringRef FloatABI = getARMFloatABI(D, Args, Triple);
// FIXME: Note, this is a hack, the LLVM backend doesn't actually use these
// yet (it uses the -mfloat-abi and -msoft-float options), and it is
// stripped out by the ARM target.
// Use software floating point operations?
if (FloatABI == "soft")
Features.push_back("+soft-float");
if (!ForAS) {
// FIXME: Note, this is a hack, the LLVM backend doesn't actually use these
// yet (it uses the -mfloat-abi and -msoft-float options), and it is
// stripped out by the ARM target. We should probably pass this a new
// -target-option, which is handled by the -cc1/-cc1as invocation.
//
// FIXME2: For consistency, it would be ideal if we set up the target
// machine state the same when using the frontend or the assembler. We don't
// currently do that for the assembler, we pass the options directly to the
// backend and never even instantiate the frontend TargetInfo. If we did,
// and used its handleTargetFeatures hook, then we could ensure the
// assembler and the frontend behave the same.
// Use software floating point argument passing?
if (FloatABI != "hard")
Features.push_back("+soft-float-abi");
// Use software floating point operations?
if (FloatABI == "soft")
Features.push_back("+soft-float");
// Use software floating point argument passing?
if (FloatABI != "hard")
Features.push_back("+soft-float-abi");
}
// Honor -mfpu=.
if (const Arg *A = Args.getLastArg(options::OPT_mfpu_EQ))
@ -1498,7 +1510,8 @@ static void getAArch64TargetFeatures(const Driver &D, const ArgList &Args,
}
static void getTargetFeatures(const Driver &D, const llvm::Triple &Triple,
const ArgList &Args, ArgStringList &CmdArgs) {
const ArgList &Args, ArgStringList &CmdArgs,
bool ForAS) {
std::vector<const char *> Features;
switch (Triple.getArch()) {
default:
@ -1512,7 +1525,7 @@ static void getTargetFeatures(const Driver &D, const llvm::Triple &Triple,
case llvm::Triple::arm:
case llvm::Triple::thumb:
getARMTargetFeatures(D, Triple, Args, Features);
getARMTargetFeatures(D, Triple, Args, Features, ForAS);
break;
case llvm::Triple::ppc:
@ -2530,7 +2543,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
}
// Add the target features
getTargetFeatures(D, ETriple, Args, CmdArgs);
getTargetFeatures(D, ETriple, Args, CmdArgs, false);
// Add target specific flags.
switch(getToolChain().getArch()) {
@ -4040,7 +4053,7 @@ void ClangAs::ConstructJob(Compilation &C, const JobAction &JA,
// Add the target features
const Driver &D = getToolChain().getDriver();
getTargetFeatures(D, Triple, Args, CmdArgs);
getTargetFeatures(D, Triple, Args, CmdArgs, true);
// Ignore explicit -force_cpusubtype_ALL option.
(void) Args.hasArg(options::OPT_force__cpusubtype__ALL);

View File

@ -100,3 +100,7 @@
// RUN: %clang -target arm-linux-gnueabihf %s -### 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-HF %s
// CHECK-HF: "-target-cpu" "arm1136jf-s"
// RUN: %clang -target armv7-apple-darwin -x assembler %s -### -c 2>&1 \
// RUN: | FileCheck --check-prefix=ASM %s
// ASM-NOT: -target-feature