Index: lib/Driver/Tools.cpp =================================================================== --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -1923,6 +1923,10 @@ else CmdArgs.push_back("-plugin-opt=-debugger-tune=gdb"); } + for (const Arg *A : Args.filtered(options::OPT_mllvm)) { + CmdArgs.push_back(Args.MakeArgString("-plugin-opt=" + + StringRef(A->getValue(0)))); + } } /// This is a helper function for validating the optional refinement step Index: test/Driver/gold-lto.c =================================================================== --- test/Driver/gold-lto.c +++ test/Driver/gold-lto.c @@ -7,6 +7,12 @@ // CHECK-X86-64-BASIC: "-plugin-opt=O3" // CHECK-X86-64-BASIC: "-plugin-opt=foo" // +// RUN: %clang -target x86_64-unknown-linux -### %t.o -flto 2>&1 \ +// RUN: -mllvm -debug \ +// RUN: | FileCheck %s --check-prefix=CHECK-X86-64-MLLVM +// CHECK-X86-64-MLLVM: "-plugin" "{{.*}}/LLVMgold.so" +// CHECK-X86-64-MLLVM: "-plugin-opt=-debug" +// // RUN: %clang -target x86_64-unknown-linux -### %t.o -flto 2>&1 \ // RUN: -march=corei7 -Wl,-plugin-opt=foo -Ofast \ // RUN: | FileCheck %s --check-prefix=CHECK-X86-64-COREI7