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 <[email protected]>
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);
}
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);
}
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits