[PATCH] D99337: Don't pass -mllvm to gcc
Jethro Beekman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 25 07:06:26 PDT 2021
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99337.333294.patch
Type: text/x-patch
Size: 1884 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210325/3974d5c1/attachment.bin>
More information about the cfe-commits
mailing list