Index: lib/Driver/Tools.cpp =================================================================== --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -4965,6 +4965,9 @@ // assembler on assembly source files. CmdArgs.push_back("-dwarf-debug-producer"); 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 @@ -7296,6 +7299,7 @@ if (NeedsKPIC) addAssemblerKPIC(Args, CmdArgs); + Args.AddAllArgs(CmdArgs, options::OPT_I); Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, options::OPT_Xassembler); Index: test/Driver/as-options.s =================================================================== --- /dev/null +++ test/Driver/as-options.s @@ -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"