[lld] r316233 - COFF: Add type server pdb files to linkrepro tar file.
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 20 12:48:26 PDT 2017
Author: pcc
Date: Fri Oct 20 12:48:26 2017
New Revision: 316233
URL: http://llvm.org/viewvc/llvm-project?rev=316233&view=rev
Log:
COFF: Add type server pdb files to linkrepro tar file.
Differential Revision: https://reviews.llvm.org/D38977
Added:
lld/trunk/test/COFF/linkrepro-pdb.test
Modified:
lld/trunk/COFF/Driver.h
lld/trunk/COFF/PDB.cpp
lld/trunk/test/lit.cfg.py
Modified: lld/trunk/COFF/Driver.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Driver.h?rev=316233&r1=316232&r2=316233&view=diff
==============================================================================
--- lld/trunk/COFF/Driver.h (original)
+++ lld/trunk/COFF/Driver.h Fri Oct 20 12:48:26 2017
@@ -74,6 +74,8 @@ public:
void enqueueArchiveMember(const Archive::Child &C, StringRef SymName,
StringRef ParentName);
+ MemoryBufferRef takeBuffer(std::unique_ptr<MemoryBuffer> MB);
+
private:
std::unique_ptr<llvm::TarWriter> Tar; // for /linkrepro
@@ -109,7 +111,6 @@ private:
void invokeMSVC(llvm::opt::InputArgList &Args);
- MemoryBufferRef takeBuffer(std::unique_ptr<MemoryBuffer> MB);
void addBuffer(std::unique_ptr<MemoryBuffer> MB, bool WholeArchive);
void addArchiveBuffer(MemoryBufferRef MBRef, StringRef SymName,
StringRef ParentName);
Modified: lld/trunk/COFF/PDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/PDB.cpp?rev=316233&r1=316232&r2=316233&view=diff
==============================================================================
--- lld/trunk/COFF/PDB.cpp (original)
+++ lld/trunk/COFF/PDB.cpp Fri Oct 20 12:48:26 2017
@@ -10,6 +10,7 @@
#include "PDB.h"
#include "Chunks.h"
#include "Config.h"
+#include "Driver.h"
#include "Error.h"
#include "SymbolTable.h"
#include "Symbols.h"
@@ -218,9 +219,16 @@ const CVIndexMap &PDBLinker::mergeDebugT
static Expected<std::unique_ptr<pdb::NativeSession>>
tryToLoadPDB(const GUID &GuidFromObj, StringRef TSPath) {
+ ErrorOr<std::unique_ptr<MemoryBuffer>> MBOrErr = MemoryBuffer::getFile(
+ TSPath, /*FileSize=*/-1, /*RequiresNullTerminator=*/false);
+ if (!MBOrErr)
+ return errorCodeToError(MBOrErr.getError());
+
std::unique_ptr<pdb::IPDBSession> ThisSession;
- if (auto EC =
- pdb::loadDataForPDB(pdb::PDB_ReaderType::Native, TSPath, ThisSession))
+ if (auto EC = pdb::NativeSession::createFromPdb(
+ MemoryBuffer::getMemBuffer(Driver->takeBuffer(std::move(*MBOrErr)),
+ /*RequiresNullTerminator=*/false),
+ ThisSession))
return std::move(EC);
std::unique_ptr<pdb::NativeSession> NS(
Added: lld/trunk/test/COFF/linkrepro-pdb.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/linkrepro-pdb.test?rev=316233&view=auto
==============================================================================
--- lld/trunk/test/COFF/linkrepro-pdb.test (added)
+++ lld/trunk/test/COFF/linkrepro-pdb.test Fri Oct 20 12:48:26 2017
@@ -0,0 +1,9 @@
+REQUIRES: x86, gnutar
+
+RUN: rm -rf %t && mkdir -p %t && cd %t
+RUN: yaml2obj %S/Inputs/pdb-type-server-simple-a.yaml -o a.obj
+RUN: yaml2obj %S/Inputs/pdb-type-server-simple-b.yaml -o b.obj
+RUN: llvm-pdbutil yaml2pdb %S/Inputs/pdb-type-server-simple-ts.yaml -pdb ts.pdb
+RUN: lld-link a.obj b.obj -entry:main -debug -out:t.exe -pdb:t.pdb -nodefaultlib -linkrepro:.
+RUN: tar xOf repro.tar repro/%:t/ts.pdb > repro-ts.pdb
+RUN: diff ts.pdb repro-ts.pdb
Modified: lld/trunk/test/lit.cfg.py
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/lit.cfg.py?rev=316233&r1=316232&r2=316233&view=diff
==============================================================================
--- lld/trunk/test/lit.cfg.py (original)
+++ lld/trunk/test/lit.cfg.py Fri Oct 20 12:48:26 2017
@@ -82,3 +82,9 @@ if (lit.util.which('cvtres', config.envi
if (config.llvm_libxml2_enabled == '1'):
config.available_features.add('libxml2')
+
+tar_version = subprocess.Popen(
+ ['tar', '--version'], stdout=subprocess.PIPE, env={'LANG': 'C'})
+if 'GNU tar' in tar_version.stdout.read().decode():
+ config.available_features.add('gnutar')
+tar_version.wait()
More information about the llvm-commits
mailing list