Index: lld/trunk/MinGW/Driver.cpp =================================================================== --- lld/trunk/MinGW/Driver.cpp +++ lld/trunk/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)) Index: lld/trunk/MinGW/Options.td =================================================================== --- lld/trunk/MinGW/Options.td +++ lld/trunk/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<"">, HelpText<"Pass to the COFF linker">; Index: lld/trunk/test/MinGW/driver.test =================================================================== --- lld/trunk/test/MinGW/driver.test +++ lld/trunk/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