PR21000: pass -I options to assembler

Pass -I options to assembly so it can find files included with
.include.

Differential Revision: http://reviews.llvm.org/D7472

llvm-svn: 235915
This commit is contained in:
Artem Belevich 2015-04-27 20:51:44 +00:00
parent 017ebf09d9
commit 8fe8ed56ee
2 changed files with 16 additions and 0 deletions

View File

@ -5115,6 +5115,9 @@ void ClangAs::ConstructJob(Compilation &C, const JobAction &JA,
// assembler on assembly source files. // assembler on assembly source files.
CmdArgs.push_back("-dwarf-debug-producer"); CmdArgs.push_back("-dwarf-debug-producer");
CmdArgs.push_back(Args.MakeArgString(getClangFullVersion())); CmdArgs.push_back(Args.MakeArgString(getClangFullVersion()));
// And pass along -I options
Args.AddAllArgs(CmdArgs, options::OPT_I);
} }
// Optionally embed the -cc1as level arguments into the debug info, for build // Optionally embed the -cc1as level arguments into the debug info, for build
@ -7584,6 +7587,7 @@ void gnutools::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
if (NeedsKPIC) if (NeedsKPIC)
addAssemblerKPIC(Args, CmdArgs); addAssemblerKPIC(Args, CmdArgs);
Args.AddAllArgs(CmdArgs, options::OPT_I);
Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA,
options::OPT_Xassembler); options::OPT_Xassembler);

View File

@ -0,0 +1,12 @@
// PR21000: Test that -I is passed to assembler.
// RUN: %clang -### -c -no-integrated-as %s -Ifoo_dir 2>&1 | FileCheck --check-prefix=BARE_INCLUDE1 %s
// BARE_INCLUDE1: "-I" "foo_dir"
// RUN: %clang -### -c -no-integrated-as %s -I foo_dir 2>&1 | FileCheck --check-prefix=BARE_INCLUDE2 %s
// BARE_INCLUDE2: "-I" "foo_dir"
// RUN: %clang -### -c -integrated-as %s -Ifoo_dir 2>&1 | FileCheck --check-prefix=BARE_INT_INCLUDE1 %s
// BARE_INT_INCLUDE1: "-I" "foo_dir"
// RUN: %clang -### -c -integrated-as %s -I foo_dir 2>&1 | FileCheck --check-prefix=BARE_INT_INCLUDE2 %s
// BARE_INT_INCLUDE2: "-I" "foo_dir"