[PATCH] D67385: Pass -mcmodel to LTO plugin

Kuan Hsu Chen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 14 08:35:07 PDT 2019


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=") +


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67385.220218.patch
Type: text/x-patch
Size: 1161 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190914/4078f051/attachment.bin>


More information about the cfe-commits mailing list