[PATCH] D123185: [LLD][COFF] Follow-up on 98bc304 - make collision case faster
Tobias Hieta via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 6 08:10:15 PDT 2022
thieta updated this revision to Diff 420870.
thieta added a comment.
Fixed an issue and added more careful testing.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D123185/new/
https://reviews.llvm.org/D123185
Files:
lld/COFF/DebugTypes.cpp
lld/test/COFF/pdb-type-server-guid-collision-invalid.test
lld/test/COFF/pdb-type-server-guid-collision-valid.test
Index: lld/test/COFF/pdb-type-server-guid-collision-valid.test
===================================================================
--- lld/test/COFF/pdb-type-server-guid-collision-valid.test
+++ lld/test/COFF/pdb-type-server-guid-collision-valid.test
@@ -7,11 +7,9 @@
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: ============================================================
Index: lld/test/COFF/pdb-type-server-guid-collision-invalid.test
===================================================================
--- lld/test/COFF/pdb-type-server-guid-collision-invalid.test
+++ lld/test/COFF/pdb-type-server-guid-collision-invalid.test
@@ -6,15 +6,21 @@
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]+}}
Index: lld/COFF/DebugTypes.cpp
===================================================================
--- lld/COFF/DebugTypes.cpp
+++ lld/COFF/DebugTypes.cpp
@@ -60,10 +60,7 @@
// 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 @@
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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123185.420870.patch
Type: text/x-patch
Size: 4708 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220406/09a066fa/attachment.bin>
More information about the llvm-commits
mailing list