rengolin created this revision. rengolin added reviewers: tra, echristo, mcrosier. rengolin added a subscriber: cfe-commits. rengolin set the repository for this revision to rL LLVM.
Fixes PR21000. Patch by Artem Belevich. This is a re-take on D7472, but with tests that should not fail on other architectures. The mistake was that changing one assembler would work on all of them. If we only test for the ones we changed, the tests should pass on all targets. Repository: rL LLVM http://reviews.llvm.org/D11185 Files: lib/Driver/Tools.cpp test/Driver/as-options.s Index: test/Driver/as-options.s =================================================================== --- /dev/null +++ test/Driver/as-options.s @@ -0,0 +1,37 @@ +// PR21000: Test that -I is passed to both external and integrated assemblers. + +// RUN: %clang -target x86_64-linux-gnu -c -no-integrated-as %s \ +// RUN: -Ifoo_dir -### 2>&1 \ +// RUN: | FileCheck %s + +// RUN: %clang -target x86_64-linux-gnu -c -no-integrated-as %s \ +// RUN: -I foo_dir -### 2>&1 \ +// RUN: | FileCheck %s + +// RUN: %clang -target x86_64-linux-gnu -c -integrated-as %s \ +// RUN: -Ifoo_dir -### 2>&1 \ +// RUN: | FileCheck %s + +// RUN: %clang -target x86_64-linux-gnu -c -integrated-as %s \ +// RUN: -I foo_dir -### 2>&1 \ +// RUN: | FileCheck %s + +// Other GNU targets + +// RUN: %clang -target aarch64-linux-gnu -c -no-integrated-as %s \ +// RUN: -Ifoo_dir -### 2>&1 \ +// RUN: | FileCheck %s + +// RUN: %clang -target aarch64-linux-gnu -c -integrated-as %s \ +// RUN: -Ifoo_dir -### 2>&1 \ +// RUN: | FileCheck %s + +// RUN: %clang -target armv7-linux-gnueabihf -c -no-integrated-as %s \ +// RUN: -Ifoo_dir -### 2>&1 \ +// RUN: | FileCheck %s + +// RUN: %clang -target armv7-linux-gnueabihf -c -integrated-as %s \ +// RUN: -Ifoo_dir -### 2>&1 \ +// RUN: | FileCheck %s + +// CHECK: "-I" "foo_dir" Index: lib/Driver/Tools.cpp =================================================================== --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -5320,6 +5320,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 @@ -7797,6 +7800,7 @@ if (NeedsKPIC) addAssemblerKPIC(Args, CmdArgs); + Args.AddAllArgs(CmdArgs, options::OPT_I); Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, options::OPT_Xassembler); CmdArgs.push_back("-o");
Index: test/Driver/as-options.s =================================================================== --- /dev/null +++ test/Driver/as-options.s @@ -0,0 +1,37 @@ +// PR21000: Test that -I is passed to both external and integrated assemblers. + +// RUN: %clang -target x86_64-linux-gnu -c -no-integrated-as %s \ +// RUN: -Ifoo_dir -### 2>&1 \ +// RUN: | FileCheck %s + +// RUN: %clang -target x86_64-linux-gnu -c -no-integrated-as %s \ +// RUN: -I foo_dir -### 2>&1 \ +// RUN: | FileCheck %s + +// RUN: %clang -target x86_64-linux-gnu -c -integrated-as %s \ +// RUN: -Ifoo_dir -### 2>&1 \ +// RUN: | FileCheck %s + +// RUN: %clang -target x86_64-linux-gnu -c -integrated-as %s \ +// RUN: -I foo_dir -### 2>&1 \ +// RUN: | FileCheck %s + +// Other GNU targets + +// RUN: %clang -target aarch64-linux-gnu -c -no-integrated-as %s \ +// RUN: -Ifoo_dir -### 2>&1 \ +// RUN: | FileCheck %s + +// RUN: %clang -target aarch64-linux-gnu -c -integrated-as %s \ +// RUN: -Ifoo_dir -### 2>&1 \ +// RUN: | FileCheck %s + +// RUN: %clang -target armv7-linux-gnueabihf -c -no-integrated-as %s \ +// RUN: -Ifoo_dir -### 2>&1 \ +// RUN: | FileCheck %s + +// RUN: %clang -target armv7-linux-gnueabihf -c -integrated-as %s \ +// RUN: -Ifoo_dir -### 2>&1 \ +// RUN: | FileCheck %s + +// CHECK: "-I" "foo_dir" Index: lib/Driver/Tools.cpp =================================================================== --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -5320,6 +5320,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 @@ -7797,6 +7800,7 @@ if (NeedsKPIC) addAssemblerKPIC(Args, CmdArgs); + Args.AddAllArgs(CmdArgs, options::OPT_I); Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, options::OPT_Xassembler); CmdArgs.push_back("-o");
_______________________________________________ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits