jethrogb created this revision.
jethrogb added reviewers: jyknight, MaskRay.
jethrogb requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
When forwarding command line options to GCC, don't forward -mllvm.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D99337
Files:
clang/lib/Driver/ToolChains/Gnu.cpp
clang/test/Driver/gcc_forward.c
Index: clang/test/Driver/gcc_forward.c
===
--- clang/test/Driver/gcc_forward.c
+++ clang/test/Driver/gcc_forward.c
@@ -1,4 +1,4 @@
-// Check that we don't try to forward -Xclang or -mlinker-version to GCC.
+// Check that we don't try to forward -Xclang, -mlinker-version or -mllvm to
GCC.
// PR12920 -- Check also we may not forward W_Group options to GCC.
//
// RUN: %clang -target powerpc-unknown-unknown \
@@ -6,6 +6,7 @@
// RUN: -Wall -Wdocumentation \
// RUN: -Xclang foo-bar \
// RUN: -march=x86-64 \
+// RUN: -mllvm -x86-experimental-lvi-inline-asm-hardening \
// RUN: -mlinker-version=10 -### 2> %t
// RUN: FileCheck < %t %s
//
@@ -19,12 +20,16 @@
// CHECK-NOT: "-mlinker-version=10"
// CHECK-NOT: "-Xclang"
// CHECK-NOT: "foo-bar"
+// CHECK-NOT: "-mllvm"
+// CHECK-NOT: "-x86-experimental-lvi-inline-asm-hardening"
// CHECK-NOT: "-Wall"
// CHECK-NOT: "-Wdocumentation"
// CHECK: -march
// CHECK-NOT: "-mlinker-version=10"
// CHECK-NOT: "-Xclang"
// CHECK-NOT: "foo-bar"
+// CHECK-NOT: "-mllvm"
+// CHECK-NOT: "-x86-experimental-lvi-inline-asm-hardening"
// CHECK-NOT: "-Wall"
// CHECK-NOT: "-Wdocumentation"
// CHECK: "-o" "a.out"
Index: clang/lib/Driver/ToolChains/Gnu.cpp
===
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -41,7 +41,8 @@
// Don't forward inputs from the original command line. They are added from
// InputInfoList.
return O.getKind() != Option::InputClass &&
- !O.hasFlag(options::DriverOption) && !O.hasFlag(options::LinkerInput);
+ !O.hasFlag(options::DriverOption) && !O.hasFlag(options::LinkerInput)
&&
+ !O.matches(options::OPT_mllvm);
}
// Switch CPU names not recognized by GNU assembler to a close CPU that it does
Index: clang/test/Driver/gcc_forward.c
===
--- clang/test/Driver/gcc_forward.c
+++ clang/test/Driver/gcc_forward.c
@@ -1,4 +1,4 @@
-// Check that we don't try to forward -Xclang or -mlinker-version to GCC.
+// Check that we don't try to forward -Xclang, -mlinker-version or -mllvm to GCC.
// PR12920 -- Check also we may not forward W_Group options to GCC.
//
// RUN: %clang -target powerpc-unknown-unknown \
@@ -6,6 +6,7 @@
// RUN: -Wall -Wdocumentation \
// RUN: -Xclang foo-bar \
// RUN: -march=x86-64 \
+// RUN: -mllvm -x86-experimental-lvi-inline-asm-hardening \
// RUN: -mlinker-version=10 -### 2> %t
// RUN: FileCheck < %t %s
//
@@ -19,12 +20,16 @@
// CHECK-NOT: "-mlinker-version=10"
// CHECK-NOT: "-Xclang"
// CHECK-NOT: "foo-bar"
+// CHECK-NOT: "-mllvm"
+// CHECK-NOT: "-x86-experimental-lvi-inline-asm-hardening"
// CHECK-NOT: "-Wall"
// CHECK-NOT: "-Wdocumentation"
// CHECK: -march
// CHECK-NOT: "-mlinker-version=10"
// CHECK-NOT: "-Xclang"
// CHECK-NOT: "foo-bar"
+// CHECK-NOT: "-mllvm"
+// CHECK-NOT: "-x86-experimental-lvi-inline-asm-hardening"
// CHECK-NOT: "-Wall"
// CHECK-NOT: "-Wdocumentation"
// CHECK: "-o" "a.out"
Index: clang/lib/Driver/ToolChains/Gnu.cpp
===
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -41,7 +41,8 @@
// Don't forward inputs from the original command line. They are added from
// InputInfoList.
return O.getKind() != Option::InputClass &&
- !O.hasFlag(options::DriverOption) && !O.hasFlag(options::LinkerInput);
+ !O.hasFlag(options::DriverOption) && !O.hasFlag(options::LinkerInput) &&
+ !O.matches(options::OPT_mllvm);
}
// Switch CPU names not recognized by GNU assembler to a close CPU that it does
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits