summaryrefslogtreecommitdiff
path: root/lld
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2018-12-13 18:11:33 +0000
committerZachary Turner <zturner@google.com>2018-12-13 18:11:33 +0000
commit10689c3e8e7457b23aea154672668663405ac7df (patch)
tree872b1c877eb0f9ed258e7565779e8c8dd622ba03 /lld
parent06d487828058d12e0ea8c28f3e4547bed3e8fc34 (diff)
Correctly handle skewed streams in drop_front() method.
When calling BinaryStreamArray::drop_front(), if the stream is skewed it means we must never drop the first bytes of the stream since offsets which occur in records assume the existence of those bytes. So if we want to skip the first record in a stream, then what we really want to do is just set the begin pointer to the next record. But we shouldn't actually remove those bytes from the underlying view of the data.
Diffstat (limited to 'lld')
-rw-r--r--lld/COFF/PDB.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lld/COFF/PDB.cpp b/lld/COFF/PDB.cpp
index ccce0e711c1..9c3ff4e7f89 100644
--- a/lld/COFF/PDB.cpp
+++ b/lld/COFF/PDB.cpp
@@ -474,7 +474,10 @@ PDBLinker::mergeDebugT(ObjFile *File, CVIndexMap *ObjectIndexMap) {
// Drop LF_PRECOMP record from the input stream, as it needs to be replaced
// with the precompiled headers object type stream.
- Types.drop_front();
+ // Note that we can't just call Types.drop_front(), as we explicitly want to
+ // rebase the stream.
+ Types.setUnderlyingStream(
+ Types.getUnderlyingStream().drop_front(FirstType->RecordData.size()));
}
// Fill in the temporary, caller-provided ObjectIndexMap.