[PATCH] D46796: [LLD] [MinGW] Add a LLD specific option -pdb
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat May 12 13:23:42 PDT 2018
mstorsjo created this revision.
mstorsjo added reviewers: ruiu, rnk, zturner.
Herald added subscribers: JDevlieghere, aprantl.
This allows producing pdb debug info. This is a LLD specific option since GCC and GNU binutils doesn't support the PDB file format.
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D46796
Files:
MinGW/Driver.cpp
MinGW/Options.td
test/MinGW/driver.test
Index: test/MinGW/driver.test
===================================================================
--- test/MinGW/driver.test
+++ 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
Index: MinGW/Options.td
===================================================================
--- MinGW/Options.td
+++ 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: MinGW/Driver.cpp
===================================================================
--- MinGW/Driver.cpp
+++ 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))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46796.146484.patch
Type: text/x-patch
Size: 1768 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180512/d4e58118/attachment.bin>
More information about the llvm-commits
mailing list