diff options
| author | Rui Ueyama <ruiu@google.com> | 2014-11-25 19:01:01 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2014-11-25 19:01:01 +0000 |
| commit | 0d9a181d9d36523cadd6fb17d5465778541ea202 (patch) | |
| tree | 6a0dbb9cd61f823fcbf191ddee7d4c0c8a5cd689 /lld/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp | |
| parent | bda193edffea77f7262b041878d5a1d85c917700 (diff) | |
| download | bcm5719-llvm-0d9a181d9d36523cadd6fb17d5465778541ea202.tar.gz bcm5719-llvm-0d9a181d9d36523cadd6fb17d5465778541ea202.zip | |
[PECOFF] Create an empty PDB file if debug option is enabled.
There are many build files in the wild that depend on the fact that
link.exe produces a PDB file if /DEBUG option is given. They fail
if the file is not created.
This patch is to make LLD create an empty (dummy) file to satisfy
such build targets. This doesn't do anything other than "touching"
the file.
If a target depends on the content of the PDB file, this workaround
is no help, of course. Otherwise this patch should help build some
stuff.
llvm-svn: 222773
Diffstat (limited to 'lld/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp')
| -rw-r--r-- | lld/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/lld/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp b/lld/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp index 1e5962eaced..b8f8e39cdcd 100644 --- a/lld/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp +++ b/lld/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp @@ -14,6 +14,7 @@ #include "InferSubsystemPass.h" #include "LinkerGeneratedSymbolFile.h" #include "LoadConfigPass.h" +#include "PDBPass.h" #include "lld/Core/PassManager.h" #include "lld/Core/Simple.h" #include "lld/Passes/LayoutPass.h" @@ -274,15 +275,27 @@ void PECOFFLinkingContext::addDllExport(ExportDesc &desc) { _dllExports.push_back(desc); } +static std::string replaceExtension(StringRef path, StringRef ext) { + SmallString<128> ss = path; + llvm::sys::path::replace_extension(ss, ext); + return ss.str(); +} + std::string PECOFFLinkingContext::getOutputImportLibraryPath() const { if (!_implib.empty()) return _implib; - SmallString<128> path = outputPath(); - llvm::sys::path::replace_extension(path, ".lib"); - return path.str(); + return replaceExtension(outputPath(), ".lib"); +} + +std::string PECOFFLinkingContext::getPDBFilePath() const { + assert(_debug); + if (!_pdbFilePath.empty()) + return _pdbFilePath; + return replaceExtension(outputPath(), ".pdb"); } void PECOFFLinkingContext::addPasses(PassManager &pm) { + pm.add(std::unique_ptr<Pass>(new pecoff::PDBPass(*this))); pm.add(std::unique_ptr<Pass>(new pecoff::EdataPass(*this))); pm.add(std::unique_ptr<Pass>(new pecoff::IdataPass(*this))); pm.add(std::unique_ptr<Pass>(new LayoutPass(registry()))); |

