[PATCH] D37119: lld-link: Use opt:noref by default in debug builds

Alex Telishev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 24 13:43:20 PDT 2017


alex.telishev updated this revision to Diff 112606.
alex.telishev added a comment.

Set `DoGC` and `DoICF` flags together with `Debug`


https://reviews.llvm.org/D37119

Files:
  lld/COFF/Driver.cpp


Index: lld/COFF/Driver.cpp
===================================================================
--- lld/COFF/Driver.cpp
+++ lld/COFF/Driver.cpp
@@ -756,15 +756,6 @@
   if (Args.hasArg(OPT_force) || Args.hasArg(OPT_force_unresolved))
     Config->Force = true;
 
-  // Handle /debug
-  if (Args.hasArg(OPT_debug)) {
-    Config->Debug = true;
-    Config->DebugTypes =
-        Args.hasArg(OPT_debugtype)
-            ? parseDebugType(Args.getLastArg(OPT_debugtype)->getValue())
-            : getDefaultDebugType(Args);
-  }
-
   // Create a dummy PDB file to satisfy build sytem rules.
   if (auto *Arg = Args.getLastArg(OPT_pdb))
     Config->PDBPath = Arg->getValue();
@@ -842,6 +833,19 @@
   if (auto *Arg = Args.getLastArg(OPT_implib))
     Config->Implib = Arg->getValue();
 
+  // Handle /debug
+  if (Args.hasArg(OPT_debug)) {
+    Config->Debug = true;
+    Config->DebugTypes =
+        Args.hasArg(OPT_debugtype)
+            ? parseDebugType(Args.getLastArg(OPT_debugtype)->getValue())
+            : getDefaultDebugType(Args);
+
+    // msvc linker uses /opt:noref by default in debug builds
+    Config->DoGC = false;
+    Config->DoICF = false;
+  }
+
   // Handle /opt
   for (auto *Arg : Args.filtered(OPT_opt)) {
     std::string Str = StringRef(Arg->getValue()).lower();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37119.112606.patch
Type: text/x-patch
Size: 1289 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170824/bb9a43a2/attachment.bin>


More information about the llvm-commits mailing list