diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp --- a/clang/lib/Driver/ToolChains/Gnu.cpp +++ b/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 diff --git a/clang/test/Driver/gcc_forward.c b/clang/test/Driver/gcc_forward.c --- a/clang/test/Driver/gcc_forward.c +++ b/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"