diff options
author | Ted Kremenek <kremenek@apple.com> | 2013-03-12 21:08:08 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2013-03-12 21:08:08 +0000 |
commit | acd31db0ce8aab71f00506c9d8bd1b390e6d9f81 (patch) | |
tree | b619747c65afe837d3a0d2b5bd79223803b819ce | |
parent | bf5c33b752fe172af1f8b2c04cce3049c48f32f8 (diff) | |
download | bcm5719-llvm-acd31db0ce8aab71f00506c9d8bd1b390e6d9f81.tar.gz bcm5719-llvm-acd31db0ce8aab71f00506c9d8bd1b390e6d9f81.zip |
[driver] Only enable -fmodules-autolink if we are using the integrated assembler.
Fixes <rdar://problem/13289240>
llvm-svn: 176897
-rw-r--r-- | clang/lib/Driver/Tools.cpp | 23 | ||||
-rw-r--r-- | clang/test/Driver/modules_integrated_as.c | 6 |
2 files changed, 19 insertions, 10 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 62b1febd529..065ee7d719b 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -1414,15 +1414,21 @@ static void addExceptionArgs(const ArgList &Args, types::ID InputType, CmdArgs.push_back("-fexceptions"); } +/// \brief Check if the toolchain should use the integrated assembler. +static bool ShouldUseIntegratedAssembler(const ArgList &Args, + const ToolChain &TC) { + return Args.hasFlag(options::OPT_integrated_as, + options::OPT_no_integrated_as, + TC.IsIntegratedAssemblerDefault()); +} + static bool ShouldDisableCFI(const ArgList &Args, const ToolChain &TC) { bool Default = true; if (TC.getTriple().isOSDarwin()) { // The native darwin assembler doesn't support cfi directives, so // we disable them if we think the .s file will be passed to it. - Default = Args.hasFlag(options::OPT_integrated_as, - options::OPT_no_integrated_as, - TC.IsIntegratedAssemblerDefault()); + Default = ShouldUseIntegratedAssembler(Args, TC); } return !Args.hasFlag(options::OPT_fdwarf2_cfi_asm, options::OPT_fno_dwarf2_cfi_asm, @@ -1431,13 +1437,9 @@ static bool ShouldDisableCFI(const ArgList &Args, static bool ShouldDisableDwarfDirectory(const ArgList &Args, const ToolChain &TC) { - bool IsIADefault = TC.IsIntegratedAssemblerDefault(); - bool UseIntegratedAs = Args.hasFlag(options::OPT_integrated_as, - options::OPT_no_integrated_as, - IsIADefault); bool UseDwarfDirectory = Args.hasFlag(options::OPT_fdwarf_directory_asm, options::OPT_fno_dwarf_directory_asm, - UseIntegratedAs); + ShouldUseIntegratedAssembler(Args, TC)); return !UseDwarfDirectory; } @@ -2802,8 +2804,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, Args.AddAllArgs(CmdArgs, options::OPT_fmodules_ignore_macro); // -fmodules-autolink (on by default when modules is enabled) automatically - // links against libraries for imported modules. - if (HaveModules && + // links against libraries for imported modules. This requires the + // integrated assembler. + if (HaveModules && ShouldUseIntegratedAssembler(Args, getToolChain()) && Args.hasFlag(options::OPT_fmodules_autolink, options::OPT_fno_modules_autolink, true)) { diff --git a/clang/test/Driver/modules_integrated_as.c b/clang/test/Driver/modules_integrated_as.c new file mode 100644 index 00000000000..0abd18fc5fe --- /dev/null +++ b/clang/test/Driver/modules_integrated_as.c @@ -0,0 +1,6 @@ +// RUN: %clang -fsyntax-only modules_integrated_as.c -fmodules -no-integrated-as -### 2>&1 | FileCheck %s + +// Test that the autolinking feature is disabled with *not* using the +// integrated assembler. + +// CHECK-NOT: -fmodules-autolink |