[lld] r310108 - [lld] Write the absolute PDB path to the debug directory.
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 4 13:02:55 PDT 2017
Author: zturner
Date: Fri Aug 4 13:02:55 2017
New Revision: 310108
URL: http://llvm.org/viewvc/llvm-project?rev=310108&view=rev
Log:
[lld] Write the absolute PDB path to the debug directory.
This matches the behavior of MSVC's linker.
Differential Revision: https://reviews.llvm.org/D36334
Modified:
lld/trunk/COFF/Writer.cpp
Modified: lld/trunk/COFF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Writer.cpp?rev=310108&r1=310107&r2=310108&view=diff
==============================================================================
--- lld/trunk/COFF/Writer.cpp (original)
+++ lld/trunk/COFF/Writer.cpp Fri Aug 4 13:02:55 2017
@@ -78,8 +78,15 @@ private:
};
class CVDebugRecordChunk : public Chunk {
+public:
+ CVDebugRecordChunk() {
+ PDBAbsPath = Config->PDBPath;
+ if (!PDBAbsPath.empty())
+ llvm::sys::fs::make_absolute(PDBAbsPath);
+ }
+
size_t getSize() const override {
- return sizeof(codeview::DebugInfo) + Config->PDBPath.size() + 1;
+ return sizeof(codeview::DebugInfo) + PDBAbsPath.size() + 1;
}
void writeTo(uint8_t *B) const override {
@@ -91,12 +98,13 @@ class CVDebugRecordChunk : public Chunk
// variable sized field (PDB Path)
auto *P = reinterpret_cast<char *>(B + OutputSectionOff + sizeof(*DI));
- if (!Config->PDBPath.empty())
- memcpy(P, Config->PDBPath.data(), Config->PDBPath.size());
- P[Config->PDBPath.size()] = '\0';
+ if (!PDBAbsPath.empty())
+ memcpy(P, PDBAbsPath.data(), PDBAbsPath.size());
+ P[PDBAbsPath.size()] = '\0';
}
-public:
+private:
+ SmallString<128> PDBAbsPath;
mutable codeview::DebugInfo *DI = nullptr;
};
More information about the llvm-commits
mailing list