Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/llvm/llvm-project.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lld/COFF
diff options
context:
space:
mode:
Diffstat (limited to 'lld/COFF')
-rw-r--r--lld/COFF/Driver.cpp4
-rw-r--r--lld/COFF/Driver.h2
-rw-r--r--lld/COFF/DriverUtils.cpp7
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