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 = 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)) { Index: MinGW/Options.td =================================================================== --- MinGW/Options.td +++ MinGW/Options.td @@ -57,7 +57,9 @@ HelpText<"Print (but do not run) the commands to run for this compilation">; 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: S<"pdb">, HelpText<"Specify output PDB debug information file. " + "Defaults to the output filename, with a pdb suffix, if given an empty argument">; +def pdb_eq: J<"pdb=">, Alias; def Xlink : J<"Xlink=">, MetaVarName<"">, HelpText<"Pass to the COFF linker">; 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