From 4d5707cc4dca1c25a2c40ea1535fbb47d966f2d9 Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Wed, 6 Jan 2016 07:24:45 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@256919 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Driver/Tools.cpp | 5 +++++ lib/Driver/Tools.h | 4 ++++ test/Driver/fortran.f95 | 18 ++++++++++++------ 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 7af1899b38..c614452257 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -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; diff --git a/lib/Driver/Tools.h b/lib/Driver/Tools.h index 314315dea0..168662f7e7 100644 --- a/lib/Driver/Tools.h +++ b/lib/Driver/Tools.h @@ -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, diff --git a/test/Driver/fortran.f95 b/test/Driver/fortran.f95 index 9334cbec44..982f4eb5e6 100644 --- a/test/Driver/fortran.f95 +++ b/test/Driver/fortran.f95 @@ -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 -- 2.50.1