[PATCH] D11185: Pass -I options to integrates and external assemblers

Renato Golin renato.golin at linaro.org
Tue Jul 14 06:32:55 PDT 2015


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");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11185.29672.patch
Type: text/x-patch
Size: 2054 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150714/ea82cf4c/attachment.bin>


More information about the cfe-commits mailing list