forked from OSchip/llvm-project
[PDB] Check the type server guid when ghashing
Previously we simply didn't check this. Prereq to make the test suite pass with ghash enabled by default. Differential Revision: https://reviews.llvm.org/D102885
This commit is contained in:
parent
748db5bfac
commit
e73203a561
|
@ -54,7 +54,8 @@ public:
|
|||
auto expectedInfo = file.getPDBInfoStream();
|
||||
if (!expectedInfo)
|
||||
return;
|
||||
auto it = mappings.emplace(expectedInfo->getGuid(), this);
|
||||
Guid = expectedInfo->getGuid();
|
||||
auto it = mappings.emplace(Guid, this);
|
||||
assert(it.second);
|
||||
(void)it;
|
||||
}
|
||||
|
@ -71,6 +72,9 @@ public:
|
|||
// TpiSource for IPI stream.
|
||||
TypeServerIpiSource *ipiSrc = nullptr;
|
||||
|
||||
// The PDB signature GUID.
|
||||
codeview::GUID Guid;
|
||||
|
||||
static std::map<codeview::GUID, TypeServerSource *> mappings;
|
||||
};
|
||||
|
||||
|
@ -429,6 +433,15 @@ Expected<TypeServerSource *> UseTypeServerSource::getTypeServerSource() {
|
|||
return createFileError(tsPath, std::move(*pdb->loadErr));
|
||||
|
||||
tsSrc = (TypeServerSource *)pdb->debugTypesObj;
|
||||
|
||||
// Just because a file with a matching name was found and it was an actual
|
||||
// PDB file doesn't mean it matches. For it to match the InfoStream's GUID
|
||||
// must match the GUID specified in the TypeServer2 record.
|
||||
if (tsSrc->Guid != tsId) {
|
||||
return createFileError(tsPath,
|
||||
make_error<pdb::PDBError>(
|
||||
pdb::pdb_error_code::signature_out_of_date));
|
||||
}
|
||||
}
|
||||
return tsSrc;
|
||||
}
|
||||
|
@ -443,14 +456,6 @@ Error UseTypeServerSource::mergeDebugT(TypeMerger *m) {
|
|||
if (!expectedInfo)
|
||||
return expectedInfo.takeError();
|
||||
|
||||
// Just because a file with a matching name was found and it was an actual
|
||||
// PDB file doesn't mean it matches. For it to match the InfoStream's GUID
|
||||
// must match the GUID specified in the TypeServer2 record.
|
||||
if (expectedInfo->getGuid() != typeServerDependency.getGuid())
|
||||
return createFileError(
|
||||
typeServerDependency.getName(),
|
||||
make_error<pdb::PDBError>(pdb::pdb_error_code::signature_out_of_date));
|
||||
|
||||
// Reuse the type index map of the type server.
|
||||
tpiMap = (*tsSrc)->tpiMap;
|
||||
ipiMap = (*tsSrc)->ipiMap;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
# RUN: cd %S/Inputs
|
||||
# RUN: yaml2obj %s -o %t.obj
|
||||
# RUN: lld-link %t.obj -out:%t.exe -debug -pdb:%t.pdb -nodefaultlib -entry:main 2>&1 | FileCheck %s
|
||||
# RUN: lld-link %t.obj -out:%t.exe -debug:ghash -pdb:%t.pdb -nodefaultlib -entry:main 2>&1 | FileCheck %s
|
||||
# RUN: cd %S
|
||||
|
||||
# CHECK: warning: Cannot use debug info for '{{.*}}.obj'
|
||||
|
|
Loading…
Reference in New Issue