summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/COFF/Config.h1
-rw-r--r--lld/COFF/Driver.cpp1
-rw-r--r--lld/COFF/Options.td1
-rw-r--r--lld/COFF/Writer.cpp2
-rw-r--r--lld/test/COFF/invalid-debug-type.test2
-rw-r--r--lld/test/COFF/pdb-none.test2
-rw-r--r--lld/test/COFF/pdb-options.test20
-rw-r--r--lld/test/COFF/pdb.test2
8 files changed, 24 insertions, 7 deletions
diff --git a/lld/COFF/Config.h b/lld/COFF/Config.h
index fafd3bcde2e..2e08ddc9e10 100644
--- a/lld/COFF/Config.h
+++ b/lld/COFF/Config.h
@@ -164,7 +164,6 @@ struct Configuration {
bool AppContainer = false;
// This is for debugging.
- bool DebugPdb = false;
bool DumpPdb = false;
};
diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp
index 4c0ea44b875..a61d134ca12 100644
--- a/lld/COFF/Driver.cpp
+++ b/lld/COFF/Driver.cpp
@@ -834,7 +834,6 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr) {
if (Args.hasArg(OPT_nosymtab))
Config->WriteSymtab = false;
Config->DumpPdb = Args.hasArg(OPT_dumppdb);
- Config->DebugPdb = Args.hasArg(OPT_debugpdb);
Config->MapFile = getMapFile(Args);
diff --git a/lld/COFF/Options.td b/lld/COFF/Options.td
index 7b5573b31cd..14a1aa04afd 100644
--- a/lld/COFF/Options.td
+++ b/lld/COFF/Options.td
@@ -102,7 +102,6 @@ def nosymtab : F<"nosymtab">;
def msvclto : F<"msvclto">;
// Flags for debugging
-def debugpdb : F<"debugpdb">;
def dumppdb : Joined<["/", "-"], "dumppdb">;
def lldmap : F<"lldmap">;
def lldmap_file : Joined<["/", "-"], "lldmap:">;
diff --git a/lld/COFF/Writer.cpp b/lld/COFF/Writer.cpp
index 6b1f1155b56..44283806134 100644
--- a/lld/COFF/Writer.cpp
+++ b/lld/COFF/Writer.cpp
@@ -258,7 +258,7 @@ void Writer::run() {
sortExceptionTable();
writeBuildId();
- if (!Config->PDBPath.empty()) {
+ if (!Config->PDBPath.empty() && Config->Debug) {
const llvm::codeview::DebugInfo *DI = nullptr;
if (Config->DebugTypes & static_cast<unsigned>(coff::DebugType::CV))
DI = BuildId->DI;
diff --git a/lld/test/COFF/invalid-debug-type.test b/lld/test/COFF/invalid-debug-type.test
index e48b3fdd2e0..10264180314 100644
--- a/lld/test/COFF/invalid-debug-type.test
+++ b/lld/test/COFF/invalid-debug-type.test
@@ -1,5 +1,5 @@
# RUN: yaml2obj < %p/Inputs/pdb1.yaml > %t1.obj
# RUN: yaml2obj < %p/Inputs/pdb2.yaml > %t2.obj
# RUN: lld-link /debug /debugtype:invalid /pdb:%t.pdb /dll /out:%t.dll /entry:main /nodefaultlib \
-# RUN: /debugpdb %t1.obj %t2.obj
+# RUN: %t1.obj %t2.obj
diff --git a/lld/test/COFF/pdb-none.test b/lld/test/COFF/pdb-none.test
index 480ff2a4ace..7e428693aec 100644
--- a/lld/test/COFF/pdb-none.test
+++ b/lld/test/COFF/pdb-none.test
@@ -1,7 +1,7 @@
# RUN: yaml2obj < %p/Inputs/pdb1.yaml > %t1.obj
# RUN: yaml2obj < %p/Inputs/pdb2.yaml > %t2.obj
# RUN: lld-link /debug /debugtype:pdata /pdb:%t.pdb /dll /out:%t.dll /entry:main /nodefaultlib \
-# RUN: /debugpdb %t1.obj %t2.obj
+# RUN: %t1.obj %t2.obj
# RUN: llvm-pdbdump pdb2yaml -pdb-stream %t.pdb | FileCheck %s
diff --git a/lld/test/COFF/pdb-options.test b/lld/test/COFF/pdb-options.test
new file mode 100644
index 00000000000..1cc4b3abda7
--- /dev/null
+++ b/lld/test/COFF/pdb-options.test
@@ -0,0 +1,20 @@
+# RUN: yaml2obj < %p/Inputs/pdb1.yaml > %t1.obj
+# RUN: yaml2obj < %p/Inputs/pdb2.yaml > %t2.obj
+
+; If /DEBUG is not specified, /pdb is ignored.
+# RUN: lld-link /pdb:%t.pdb /entry:main /nodefaultlib %t1.obj %t2.obj
+# RUN: not ls %t.pdb
+
+; If /DEBUG and /pdb are specified, it uses the specified name.
+# RUN: lld-link /DEBUG /pdb:%t.pdb /entry:main /nodefaultlib %t1.obj %t2.obj
+# RUN: ls %t.pdb
+# RUN: rm %t.pdb
+
+; If /DEBUG is specified but not /pdb, it uses a default name in the current
+; directory. This is a bit hacky since but we need to be IN our test specific
+; temporary directory when we run this command or we can't test this
+# RUN: cd %T
+# RUN: lld-link /DEBUG /entry:main /nodefaultlib %t1.obj %t2.obj
+# RUN: ls %t1.pdb
+# RUN: rm %t*
+# RUN: cd %T/..
diff --git a/lld/test/COFF/pdb.test b/lld/test/COFF/pdb.test
index aa14d290c73..f1fa4ec7c2b 100644
--- a/lld/test/COFF/pdb.test
+++ b/lld/test/COFF/pdb.test
@@ -1,7 +1,7 @@
# RUN: yaml2obj < %p/Inputs/pdb1.yaml > %t1.obj
# RUN: yaml2obj < %p/Inputs/pdb2.yaml > %t2.obj
# RUN: lld-link /debug /pdb:%t.pdb /dll /out:%t.dll /entry:main /nodefaultlib \
-# RUN: /debugpdb %t1.obj %t2.obj
+# RUN: %t1.obj %t2.obj
# RUN: llvm-pdbdump pdb2yaml -stream-metadata -stream-directory -pdb-stream \
# RUN: -dbi-stream -ipi-stream -tpi-stream %t.pdb | FileCheck %s
OpenPOWER on IntegriCloud