mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 05:56:05 +00:00
[LLD][COFF] Fix TypeServerSource matcher with more than one collision
Follow-up from 98bc304e9faded44f1d8988ffa4c5d8b50c759ec - while that commit fixed when you had two PDBs colliding on the same Guid it didn't fix the case where you had more than two PDBs using the same Guid. This commit fixes that and also tests much more carefully that all the types are correct no matter the order. Reviewed By: aganea, saudi Differential Revision: https://reviews.llvm.org/D123185
This commit is contained in:
parent
78cb11c8e4
commit
0dfa8a019d
@ -60,10 +60,7 @@ public:
|
||||
// If we hit here we have collision on Guid's in two PDB files.
|
||||
// This can happen if the PDB Guid is invalid or if we are really
|
||||
// unlucky. This should fall back on stright file-system lookup.
|
||||
TypeServerSource *tSrc = (TypeServerSource *)it.first->second;
|
||||
log("GUID collision between " + file.getFilePath() + " and " +
|
||||
tSrc->pdbInputFile->session->getPDBFile().getFilePath());
|
||||
ctx.typeServerSourceMappings.erase(Guid);
|
||||
it.first->second = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -405,11 +402,12 @@ Expected<TypeServerSource *> UseTypeServerSource::getTypeServerSource() {
|
||||
const codeview::GUID &tsId = typeServerDependency.getGuid();
|
||||
StringRef tsPath = typeServerDependency.getName();
|
||||
|
||||
TypeServerSource *tsSrc;
|
||||
TypeServerSource *tsSrc = nullptr;
|
||||
auto it = ctx.typeServerSourceMappings.find(tsId);
|
||||
if (it != ctx.typeServerSourceMappings.end()) {
|
||||
tsSrc = (TypeServerSource *)it->second;
|
||||
} else {
|
||||
}
|
||||
if (tsSrc == nullptr) {
|
||||
// The file failed to load, lookup by name
|
||||
PDBInputFile *pdb = PDBInputFile::findFromRecordPath(ctx, tsPath, file);
|
||||
if (!pdb)
|
||||
|
@ -6,15 +6,21 @@ that was set to FFFFFF...
|
||||
RUN: rm -rf %t && mkdir -p %t && cd %t
|
||||
RUN: yaml2obj %p/Inputs/pdb-type-server-guid-collision-a.yaml -o a.obj
|
||||
RUN: yaml2obj %p/Inputs/pdb-type-server-guid-collision-b.yaml -o b.obj
|
||||
RUN: sed s/b.pdb/c.pdb/ %S/Inputs/pdb-type-server-guid-collision-b.yaml | sed s/b.obj/c.obj/ | sed s/bar_gv/rab_gv/ | sed s/Bar/Rab/ | yaml2obj > c.obj
|
||||
RUN: llvm-pdbutil yaml2pdb %S/Inputs/pdb-type-server-guid-collision-a-pdb.yaml -pdb a.pdb
|
||||
RUN: llvm-pdbutil yaml2pdb %S/Inputs/pdb-type-server-guid-collision-b-pdb.yaml -pdb b.pdb
|
||||
RUN: lld-link a.obj b.obj -out:collision.dll /debug:ghash -pdb:collision.pdb -nodefaultlib /noentry /dll
|
||||
RUN: lld-link a.obj b.obj -out:collision.dll /debug:noghash -pdb:collision_noghash.pdb -nodefaultlib /noentry /dll
|
||||
RUN: sed s/b.pdb/c.pdb/ %S/Inputs/pdb-type-server-guid-collision-b-pdb.yaml | sed s/bar_gv/rab_gv/ | sed s/Bar/Rab/ | llvm-pdbutil yaml2pdb - -pdb c.pdb
|
||||
RUN: lld-link b.obj a.obj c.obj -out:collision.dll /debug:ghash -pdb:collision.pdb -nodefaultlib /noentry /dll
|
||||
RUN: lld-link a.obj b.obj c.obj -out:collision.dll /debug:noghash -pdb:collision_noghash.pdb -nodefaultlib /noentry /dll
|
||||
RUN: llvm-pdbutil dump -globals collision.pdb | FileCheck %s
|
||||
RUN: llvm-pdbutil dump -globals collision_noghash.pdb | FileCheck %s
|
||||
|
||||
CHECK-LABEL: Global Symbols
|
||||
CHECK: ============================================================
|
||||
|
||||
CHECK: 100 | S_GDATA32 [size = 24] `bar_gv`
|
||||
CHECK-NEXT: type = 0x104E (Bar), addr = 0002:0004
|
||||
CHECK-DAG: {{[0-9]+}} | S_GDATA32 [size = 24] `rab_gv`
|
||||
CHECK-NEXT: type = {{[^\s]+}} (Rab), addr = 0002:{{[0-9]+}}
|
||||
CHECK-DAG: {{[0-9]+}} | S_GDATA32 [size = 24] `bar_gv`
|
||||
CHECK-NEXT: type = {{[^\s]+}} (Bar), addr = 0002:{{[0-9]+}}
|
||||
CHECK-DAG: {{[0-9]+}} | S_GDATA32 [size = 24] `foo_gv`
|
||||
CHECK-NEXT: type = {{[^\s]+}} (Foo), addr = 0002:{{[0-9]+}}
|
||||
|
@ -7,11 +7,9 @@ RUN: sed s/{FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF}/{6C633EB7-46FE-4609-BA83-EB820
|
||||
RUN: sed s/{FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF}/{6C633EB7-46FE-4609-BA83-EB820E6F5683}/ %S/Inputs/pdb-type-server-guid-collision-b.yaml | yaml2obj > b.obj
|
||||
RUN: sed s/{FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF}/{6C633EB7-46FE-4609-BA83-EB820E6F5683}/ %S/Inputs/pdb-type-server-guid-collision-a-pdb.yaml | llvm-pdbutil yaml2pdb - -pdb a.pdb
|
||||
RUN: sed s/{FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF}/{6C633EB7-46FE-4609-BA83-EB820E6F5683}/ %S/Inputs/pdb-type-server-guid-collision-b-pdb.yaml | llvm-pdbutil yaml2pdb - -pdb b.pdb
|
||||
RUN: lld-link a.obj b.obj -out:collision.dll -debug -pdb:collision.pdb -nodefaultlib /noentry /dll -verbose 2>&1 | FileCheck %s -check-prefix LOG
|
||||
RUN: lld-link a.obj b.obj -out:collision.dll -debug -pdb:collision.pdb -nodefaultlib /noentry /dll
|
||||
RUN: llvm-pdbutil dump -globals collision.pdb | FileCheck %s -check-prefix DUMP
|
||||
|
||||
LOG: lld-link: GUID collision between b.pdb and a.pdb
|
||||
|
||||
DUMP-LABEL: Global Symbols
|
||||
DUMP: ============================================================
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user