diff options
author | Rui Ueyama <ruiu@google.com> | 2015-06-29 17:27:12 +0300 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2015-06-29 17:27:12 +0300 |
commit | 0fc26d21bdd9372db1fad27c8221c4336b6c5fd4 (patch) | |
tree | bc89ae3d533936701a07af277f1ad36ce258cb22 /lld/COFF | |
parent | 6b79ed128ad37b807bfab76714bb93c4f876fff4 (diff) |
COFF: Create an empty file for /pdb.
Most build system depends on existence or time stamp of a file.
This patch is to create an empty file for /pdb:<filename> option
just to satisfy some build rules.
llvm-svn: 240948
Diffstat (limited to 'lld/COFF')
-rw-r--r-- | lld/COFF/Driver.cpp | 4 | ||||
-rw-r--r-- | lld/COFF/Driver.h | 2 | ||||
-rw-r--r-- | lld/COFF/DriverUtils.cpp | 7 |
3 files changed, 13 insertions, 0 deletions
diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp index 8f34d1f98c1d..bde1a6c56001 100644 --- a/lld/COFF/Driver.cpp +++ b/lld/COFF/Driver.cpp @@ -630,6 +630,10 @@ bool LinkerDriver::link(llvm::ArrayRef<const char *> ArgsArr) { if (createSideBySideManifest()) return false; + // Create a dummy PDB file to satisfy build sytem rules. + if (auto *Arg = Args.getLastArg(OPT_pdb)) + touchFile(Arg->getValue()); + // Write the result. Writer Out(&Symtab); if (auto EC = Out.write(Config->OutputFile)) { diff --git a/lld/COFF/Driver.h b/lld/COFF/Driver.h index e861dead817f..c3e2186d5318 100644 --- a/lld/COFF/Driver.h +++ b/lld/COFF/Driver.h @@ -158,6 +158,8 @@ std::error_code checkFailIfMismatch(StringRef Arg); ErrorOr<std::unique_ptr<MemoryBuffer>> convertResToCOFF(const std::vector<MemoryBufferRef> &MBs); +void touchFile(StringRef Path); + // Create enum with OPT_xxx values for each option in Options.td enum { OPT_INVALID = 0, diff --git a/lld/COFF/DriverUtils.cpp b/lld/COFF/DriverUtils.cpp index 6859e40e710b..598228550014 100644 --- a/lld/COFF/DriverUtils.cpp +++ b/lld/COFF/DriverUtils.cpp @@ -517,6 +517,13 @@ std::error_code writeImportLibrary() { return E.run(); } +void touchFile(StringRef Path) { + int FD; + if (sys::fs::openFileForWrite(Path, FD, sys::fs::F_Append)) + report_fatal_error("failed to create a file"); + sys::Process::SafelyCloseFileDescriptor(FD); +} + // Create OptTable // Create prefix string literals used in Options.td |