diff options
| -rw-r--r-- | lld/COFF/Driver.cpp | 4 | ||||
| -rw-r--r-- | lld/COFF/Options.td | 1 | ||||
| -rw-r--r-- | lld/test/COFF/nopdb.test | 14 |
3 files changed, 19 insertions, 0 deletions
diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp index 027b3ac915e..93e92ef38a8 100644 --- a/lld/COFF/Driver.cpp +++ b/lld/COFF/Driver.cpp @@ -896,6 +896,10 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr) { sys::path::replace_extension(Config->PDBPath, ".pdb"); } + // Disable PDB generation if the user requested it. + if (Args.hasArg(OPT_nopdb)) + Config->PDBPath = ""; + // Set default image base if /base is not given. if (Config->ImageBase == uint64_t(-1)) Config->ImageBase = getDefaultImageBase(); diff --git a/lld/COFF/Options.td b/lld/COFF/Options.td index 73f43790afa..d7eddf16a3c 100644 --- a/lld/COFF/Options.td +++ b/lld/COFF/Options.td @@ -93,6 +93,7 @@ def help : F<"help">; def help_q : Flag<["/?", "-?"], "">, Alias<help>; // LLD extensions +def nopdb : F<"nopdb">, HelpText<"Disable PDB generation for DWARF users">; def nosymtab : F<"nosymtab">; def msvclto : F<"msvclto">; diff --git a/lld/test/COFF/nopdb.test b/lld/test/COFF/nopdb.test new file mode 100644 index 00000000000..29797bbf931 --- /dev/null +++ b/lld/test/COFF/nopdb.test @@ -0,0 +1,14 @@ +# Check that /debug creates %t.pdb. +# RUN: rm -f %t.pdb +# RUN: lld-link /debug /entry:main /out:%t.exe %p/Inputs/ret42.obj +# RUN: ls %t.pdb + +# Check that /debug /nopdb does not create %t.pdb. +# RUN: rm -f %t.pdb +# RUN: lld-link /debug /nopdb /entry:main /out:%t.exe %p/Inputs/ret42.obj +# RUN: not ls %t.pdb + +# Check that /debug /nopdb /pdb:%t.pdb does not create %t.pdb. +# RUN: rm -f %t.pdb +# RUN: lld-link /debug /nopdb /pdb:%t.pdb /entry:main /out:%t.exe %p/Inputs/ret42.obj +# RUN: not ls %t.pdb |

