[lld] r332327 - [MinGW] Add a LLD specific option -pdb
Martin Storsjo via llvm-commits
llvm-commits at lists.llvm.org
Mon May 14 23:34:19 PDT 2018
Author: mstorsjo
Date: Mon May 14 23:34:18 2018
New Revision: 332327
URL: http://llvm.org/viewvc/llvm-project?rev=332327&view=rev
Log:
[MinGW] Add a LLD specific option -pdb
This allows producing pdb debug info. This is an LLD specific option
since GCC and GNU binutils doesn't support the PDB file format.
Differential Revision: https://reviews.llvm.org/D46796
Modified:
lld/trunk/MinGW/Driver.cpp
lld/trunk/MinGW/Options.td
lld/trunk/test/MinGW/driver.test
Modified: lld/trunk/MinGW/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/MinGW/Driver.cpp?rev=332327&r1=332326&r2=332327&view=diff
==============================================================================
--- lld/trunk/MinGW/Driver.cpp (original)
+++ lld/trunk/MinGW/Driver.cpp Mon May 14 23:34:18 2018
@@ -144,14 +144,19 @@ bool mingw::link(ArrayRef<const char *>
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))
Modified: lld/trunk/MinGW/Options.td
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/MinGW/Options.td?rev=332327&r1=332326&r2=332327&view=diff
==============================================================================
--- lld/trunk/MinGW/Options.td (original)
+++ lld/trunk/MinGW/Options.td Mon May 14 23:34:18 2018
@@ -41,6 +41,7 @@ def verbose: F<"verbose">, HelpText<"Ver
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">;
Modified: lld/trunk/test/MinGW/driver.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/MinGW/driver.test?rev=332327&r1=332326&r2=332327&view=diff
==============================================================================
--- lld/trunk/test/MinGW/driver.test (original)
+++ lld/trunk/test/MinGW/driver.test Mon May 14 23:34:18 2018
@@ -90,6 +90,10 @@ RUN: ld.lld -### -m i386pep foo.o -s | F
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
More information about the llvm-commits
mailing list