[PATCH] D62004: [LLD] [MinGW] Allow requesting PDB output without giving a file name
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 16 05:31:26 PDT 2019
mstorsjo created this revision.
mstorsjo added reviewers: rnk, ruiu, pcc, dmajor.
Herald added subscribers: dexonsmith, mehdi_amini.
Herald added a project: LLVM.
Opinions on naming options wanted!
When integrating PDB output in mingw targeting build systems, it might be a lot of extra work to specify unique file names for the pdb output. Therefore allow omitting the actual file name and let it implicitly be the same name as the linker output, with a pdb extension.
As the current form of the pdb option takes a separate parameter value, e.g. "-pdb out.pdb", it is impractical to leave out the parameter value.
Therefore, introduce a second syntax for the option, with an equals sign, like -pdb=out.pdb, where the value easily can be omitted.
The form -pdb= for requesting pdb files with an implicit name should work fine, even though it looks a bit unconventional in that form.
Alternatively, a flag with a different name could be introduced (e.g. --default-pdb), or we could consider changing the flag name altogether (having -pdb be the default with an implicit name, and "--out-pdb out.pdb" for the case when naming the output file, just like the existing --out-implib). The current number of users of the lld specific pdb option is probably low, so in case renaming the option altogether is deemed the best path forward, that could also be doable.
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D62004
Files:
MinGW/Driver.cpp
MinGW/Options.td
test/MinGW/driver.test
Index: test/MinGW/driver.test
===================================================================
--- test/MinGW/driver.test
+++ test/MinGW/driver.test
@@ -99,9 +99,14 @@
STRIP-DEBUG-NOT: -debug:dwarf
RUN: ld.lld -### -m i386pep foo.o -pdb out.pdb | FileCheck -check-prefix PDB %s
+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 -pdb= | FileCheck -check-prefix PDB-DEFAULT %s
+PDB-DEFAULT: -debug
+PDB-DEFAULT-NOT: -pdb:{{.*}}
+
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
@@ -58,6 +58,7 @@
def appcontainer: F<"appcontainer">, HelpText<"Set the appcontainer flag in the executable">;
def mllvm: S<"mllvm">;
def pdb: S<"pdb">, HelpText<"Specify output PDB debug information file">;
+def pdb_eq: J<"pdb=">, Alias<pdb>;
def Xlink : J<"Xlink=">, MetaVarName<"<arg>">,
HelpText<"Pass <arg> to the COFF linker">;
Index: MinGW/Driver.cpp
===================================================================
--- MinGW/Driver.cpp
+++ MinGW/Driver.cpp
@@ -165,7 +165,9 @@
if (auto *A = Args.getLastArg(OPT_pdb)) {
Add("-debug");
- Add("-pdb:" + StringRef(A->getValue()));
+ StringRef V = StringRef(A->getValue());
+ if (!V.empty())
+ Add("-pdb:" + V);
} else if (Args.hasArg(OPT_strip_debug)) {
Add("-debug:symtab");
} else if (!Args.hasArg(OPT_strip_all)) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62004.199797.patch
Type: text/x-patch
Size: 1657 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190516/287110cc/attachment.bin>
More information about the llvm-commits
mailing list