khchen updated this revision to Diff 220218. khchen retitled this revision from "Pass -mcmodel to gold-pulgin" to "Pass -mcmodel to LTO plugin". khchen edited the summary of this revision. khchen added a comment. Herald added subscribers: steven_wu, inglorion.
added a test CHANGES SINCE LAST ACTION https://reviews.llvm.org/D67385/new/ https://reviews.llvm.org/D67385 Files: clang/lib/Driver/ToolChains/CommonArgs.cpp clang/test/Driver/lto.c Index: clang/test/Driver/lto.c =================================================================== --- clang/test/Driver/lto.c +++ clang/test/Driver/lto.c @@ -58,3 +58,7 @@ // // CHECK-TUNING-LLDB: "-plugin-opt=-debugger-tune=lldb" // CHECK-NO-TUNING-NOT: "-plugin-opt=-debugger-tune + +// RUN: %clang -target x86_64-unknown-linux -### %s -flto -mcmodel=small 2> %t +// RUN: FileCheck -check-prefix=CHECK-CODE-MODEL-OPTION < %t %s +// CHECK-CODE-MODEL-OPTION: "-plugin-opt=-code-model=small" Index: clang/lib/Driver/ToolChains/CommonArgs.cpp =================================================================== --- clang/lib/Driver/ToolChains/CommonArgs.cpp +++ clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -396,6 +396,12 @@ CmdArgs.push_back(Args.MakeArgString(Twine("-plugin-opt=O") + OOpt)); } + if (const Arg *A = Args.getLastArg(options::OPT_mcmodel_EQ)) { + StringRef ModelArg = A->getValue(); + CmdArgs.push_back( + Args.MakeArgString(Twine("-plugin-opt=-code-model=") + ModelArg)); + } + if (Args.hasArg(options::OPT_gsplit_dwarf)) { CmdArgs.push_back( Args.MakeArgString(Twine("-plugin-opt=dwo_dir=") +
Index: clang/test/Driver/lto.c =================================================================== --- clang/test/Driver/lto.c +++ clang/test/Driver/lto.c @@ -58,3 +58,7 @@ // // CHECK-TUNING-LLDB: "-plugin-opt=-debugger-tune=lldb" // CHECK-NO-TUNING-NOT: "-plugin-opt=-debugger-tune + +// RUN: %clang -target x86_64-unknown-linux -### %s -flto -mcmodel=small 2> %t +// RUN: FileCheck -check-prefix=CHECK-CODE-MODEL-OPTION < %t %s +// CHECK-CODE-MODEL-OPTION: "-plugin-opt=-code-model=small" Index: clang/lib/Driver/ToolChains/CommonArgs.cpp =================================================================== --- clang/lib/Driver/ToolChains/CommonArgs.cpp +++ clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -396,6 +396,12 @@ CmdArgs.push_back(Args.MakeArgString(Twine("-plugin-opt=O") + OOpt)); } + if (const Arg *A = Args.getLastArg(options::OPT_mcmodel_EQ)) { + StringRef ModelArg = A->getValue(); + CmdArgs.push_back( + Args.MakeArgString(Twine("-plugin-opt=-code-model=") + ModelArg)); + } + if (Args.hasArg(options::OPT_gsplit_dwarf)) { CmdArgs.push_back( Args.MakeArgString(Twine("-plugin-opt=dwo_dir=") +
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits