summaryrefslogtreecommitdiffstats
path: root/lld/COFF/PDB.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/COFF/PDB.cpp')
-rw-r--r--lld/COFF/PDB.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/lld/COFF/PDB.cpp b/lld/COFF/PDB.cpp
new file mode 100644
index 00000000000..62f9ba4df32
--- /dev/null
+++ b/lld/COFF/PDB.cpp
@@ -0,0 +1,32 @@
+//===- PDB.cpp ------------------------------------------------------------===//
+//
+// The LLVM Linker
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "Driver.h"
+#include "Error.h"
+#include "Symbols.h"
+#include "llvm/Support/FileOutputBuffer.h"
+#include <memory>
+
+using namespace llvm;
+
+const int PageSize = 4096;
+const uint8_t Magic[32] = "Microsoft C/C++ MSF 7.00\r\n\032DS\0\0";
+
+void lld::coff::createPDB(StringRef Path) {
+ // Create a file.
+ size_t FileSize = PageSize * 3;
+ ErrorOr<std::unique_ptr<FileOutputBuffer>> BufOrErr =
+ FileOutputBuffer::create(Path, FileSize);
+ error(BufOrErr, Twine("failed to open ") + Path);
+ std::unique_ptr<FileOutputBuffer> Buf = std::move(*BufOrErr);
+
+ // Write the file magic.
+ uint8_t *P = Buf->getBufferStart();
+ memcpy(P, Magic, sizeof(Magic));
+}
OpenPOWER on IntegriCloud