Index: COFF/Config.h =================================================================== --- COFF/Config.h +++ COFF/Config.h @@ -89,7 +89,7 @@ bool Debug = false; bool WriteSymtab = true; unsigned DebugTypes = static_cast(DebugType::None); - StringRef PDBPath; + llvm::SmallString<128> PDBPath; // Symbols in this set are considered as live by the garbage collector. std::set GCRoot; Index: COFF/Driver.cpp =================================================================== --- COFF/Driver.cpp +++ COFF/Driver.cpp @@ -890,6 +890,12 @@ getOutputPath((*Args.filtered_begin(OPT_INPUT))->getValue()); } + // Put the PDB next to the image if no /pdb flag was passed. + if (Config->Debug && Config->PDBPath.empty()) { + Config->PDBPath = Config->OutputFile; + llvm::sys::path::replace_extension(Config->PDBPath, ".pdb"); + } + // Set default image base if /base is not given. if (Config->ImageBase == uint64_t(-1)) Config->ImageBase = getDefaultImageBase();