Change the set of actions built for external gcc tools.

A gcc tool has an "integrated" assembler (usually gas) that it
will call to produce an object. Let it use that assembler so
that we don't have to deal with assembly syntax incompatibilities.

llvm-svn: 256919
This commit is contained in:
Eric Christopher 2016-01-06 07:24:45 +00:00
parent 1b94d9a3cc
commit 29a50bccb9
3 changed files with 21 additions and 6 deletions

View File

@ -6179,6 +6179,11 @@ void gcc::Compiler::RenderExtraToolArgs(const JobAction &JA,
case types::TY_LTO_BC:
CmdArgs.push_back("-c");
break;
// We assume we've got an "integrated" assembler in that gcc will produce an
// object file itself.
case types::TY_Object:
CmdArgs.push_back("-c");
break;
case types::TY_PP_Asm:
CmdArgs.push_back("-S");
break;

View File

@ -149,6 +149,10 @@ public:
Common(const char *Name, const char *ShortName, const ToolChain &TC)
: GnuTool(Name, ShortName, TC) {}
// A gcc tool has an "integrated" assembler that it will call to produce an
// object. Let it use that assembler so that we don't have to deal with
// assembly syntax incompatibilities.
bool hasIntegratedAssembler() const override { return true; }
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
const llvm::opt::ArgList &TCArgs,

View File

@ -1,9 +1,15 @@
// Check that the clang driver can invoke gcc to compile Fortran.
// RUN: %clang -target x86_64-unknown-linux-gnu -integrated-as -c %s -### 2>&1 \
// RUN: | FileCheck %s
// CHECK: gcc
// CHECK: "-S"
// CHECK: "-x" "f95"
// CHECK: clang
// CHECK: "-cc1as"
// RUN: | FileCheck --check-prefix=CHECK-OBJECT %s
// CHECK-OBJECT: gcc
// CHECK-OBJECT: "-c"
// CHECK-OBJECT: "-x" "f95"
// CHECK-OBJECT-NOT: cc1as
// RUN: %clang -target x86_64-unknown-linux-gnu -integrated-as -S %s -### 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-ASM %s
// CHECK-ASM: gcc
// CHECK-ASM: "-S"
// CHECK-ASM: "-x" "f95"
// CHECK-ASM-NOT: cc1