[PATCH] D64655: [Clang][Driver] don't error for unsupported as options for -no-integrates-as

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 12 12:03:54 PDT 2019


nickdesaulniers created this revision.
nickdesaulniers added a reviewer: rnk.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

The Linux kernel's assembler flag detection started failing after
r365703.  It seems that Clang was erroring for -Wa, flags that it did
not support (good), but even doing so when using -no-integrated-as
(bad).

Reported-by: Nathan Chancellor <natechancellor at gmail.com>
Link: https://github.com/ClangBuiltLinux/linux/issues/598


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D64655

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/as-options.s


Index: clang/test/Driver/as-options.s
===================================================================
--- clang/test/Driver/as-options.s
+++ clang/test/Driver/as-options.s
@@ -58,3 +58,10 @@
 // RUN:   -o /dev/null -x assembler-with-cpp %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=WARN --allow-empty %s
 // WARN-NOT: unused
+
+// Test that unsupported arguments do not cause errors when -no-integrated-as
+// is set.
+// RUN: %clang -Wa,-mno-warn-deprecated -no-integrated-as %s -S \
+// RUN:   -Wno-unused-command-line-argument 2>&1 \
+// RUN:   | FileCheck --check-prefix=NOERROR --allow-empty %s
+// NOERROR-NOT: error: unsupported argument '-mno-warn-deprecated' to option 'Wa,'
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -3552,7 +3552,7 @@
   // something. That'd be somewhat inconvenient, and it's also inconsistent with
   // most other flags -- we don't warn on -ffunction-sections not being used
   // in -E mode either for example, even though it's not really used either.
-  if (!isa<AssembleJobAction>(JA)) {
+  if (!isa<AssembleJobAction>(JA) && TC.useIntegratedAs()) {
     ArgStringList DummyArgs;
     CollectArgsForIntegratedAssembler(C, Args, DummyArgs, D);
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64655.209554.patch
Type: text/x-patch
Size: 1346 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190712/c7ec3aba/attachment.bin>


More information about the cfe-commits mailing list