[PATCH] D46796: [LLD] [MinGW] Add a LLD specific option -pdb

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 14 23:38:12 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL332327: [MinGW] Add a LLD specific option -pdb (authored by mstorsjo, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D46796?vs=146484&id=146751#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D46796

Files:
  lld/trunk/MinGW/Driver.cpp
  lld/trunk/MinGW/Options.td
  lld/trunk/test/MinGW/driver.test


Index: lld/trunk/MinGW/Options.td
===================================================================
--- lld/trunk/MinGW/Options.td
+++ lld/trunk/MinGW/Options.td
@@ -41,6 +41,7 @@
 def _HASH_HASH_HASH : Flag<["-"], "###">,
     HelpText<"Print (but do not run) the commands to run for this compilation">;
 def mllvm: S<"mllvm">;
+def pdb: S<"pdb">, HelpText<"Specify output PDB debug information file">;
 def Xlink : J<"Xlink=">, MetaVarName<"<arg>">,
     HelpText<"Pass <arg> to the COFF linker">;
 
Index: lld/trunk/MinGW/Driver.cpp
===================================================================
--- lld/trunk/MinGW/Driver.cpp
+++ lld/trunk/MinGW/Driver.cpp
@@ -144,14 +144,19 @@
   else
     Add("-out:a.exe");
 
+  if (auto *A = Args.getLastArg(OPT_pdb)) {
+    Add("-debug");
+    Add("-pdb:" + StringRef(A->getValue()));
+  } else if (!Args.hasArg(OPT_strip_all)) {
+    Add("-debug:dwarf");
+  }
+
   if (Args.hasArg(OPT_shared))
     Add("-dll");
   if (Args.hasArg(OPT_verbose))
     Add("-verbose");
   if (Args.hasArg(OPT_export_all_symbols))
     Add("-export-all-symbols");
-  if (!Args.hasArg(OPT_strip_all))
-    Add("-debug:dwarf");
   if (Args.hasArg(OPT_large_address_aware))
     Add("-largeaddressaware");
   if (Args.hasArg(OPT_kill_at))
Index: lld/trunk/test/MinGW/driver.test
===================================================================
--- lld/trunk/test/MinGW/driver.test
+++ lld/trunk/test/MinGW/driver.test
@@ -90,6 +90,10 @@
 RUN: ld.lld -### -m i386pep foo.o --strip-all | FileCheck -check-prefix STRIP %s
 STRIP-NOT: -debug:dwarf
 
+RUN: ld.lld -### -m i386pep foo.o -pdb out.pdb | FileCheck -check-prefix PDB %s
+PDB: -debug -pdb:out.pdb
+PDB-NOT: -debug:dwarf
+
 RUN: ld.lld -### -m i386pep foo.o --large-address-aware | FileCheck -check-prefix LARGE-ADDRESS-AWARE %s
 LARGE-ADDRESS-AWARE: -largeaddressaware
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46796.146751.patch
Type: text/x-patch
Size: 1858 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180515/59972552/attachment.bin>


More information about the llvm-commits mailing list