diff --git a/lld/COFF/DebugTypes.cpp b/lld/COFF/DebugTypes.cpp --- a/lld/COFF/DebugTypes.cpp +++ b/lld/COFF/DebugTypes.cpp @@ -532,7 +532,7 @@ TypeIndex::FirstNonSimpleIndex); assert(precompDependency.getTypesCount() <= precompSrc->tpiMap.size()); // Use the previously remapped index map from the precompiled headers. - indexMapStorage.append(precompSrc->tpiMap.begin(), + indexMapStorage.insert(indexMapStorage.begin(), precompSrc->tpiMap.begin(), precompSrc->tpiMap.begin() + precompDependency.getTypesCount()); @@ -842,6 +842,7 @@ } void UsePrecompSource::remapTpiWithGHashes(GHashState *g) { + fillMapFromGHashes(g, indexMapStorage); // This object was compiled with /Yu, so process the corresponding // precompiled headers object (/Yc) first. Some type indices in the current // object are referencing data in the precompiled headers object, so we need @@ -851,7 +852,6 @@ return; } - fillMapFromGHashes(g, indexMapStorage); tpiMap = indexMapStorage; ipiMap = indexMapStorage; mergeUniqueTypeRecords(file->debugTypes, diff --git a/lld/test/COFF/Inputs/precomp-ghash-obj1.obj b/lld/test/COFF/Inputs/precomp-ghash-obj1.obj new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 GIT binary patch literal 0 Hc$@ +CHECK-NEXT: 0x189E | LF_MFUNC_ID [size = 20] +CHECK-NEXT: name = {ctor}, type = 0x1003, class type = 0x1000