This change allows for link-time merging of debugging information from
Microsoft precompiled types .objs compiled with cl.exe /Z7 /Yc and /Yu.
Previously, LLD used to crash when encountering these .objs on the command line.
Precompiled types use two specific records:
- LF_PRECOMP at the begining of a type stream, to signify a dependence on a
external precomp .obj
- LF_ENDPRECOMP in a precomp .obj, which marks the end of the type stream which
should be used by the dependent .obj.
When a .obj with a LF_PRECOMP reference is found, we preempt the processing of
that .obj, and attempt to first load the precompiled .obj. Once the precompiled
.obj is loaded and remapped, we simply take its (remapped) type IndexMap and
paste it in the TypeStreamMerger, just before merging in the dependent .obj's
type indices. This allows for back-referencing precomp type records which have
already merged.
LF_PRECOMP and LF_ENDPRECOMP records are ultimately dropped from the target PDB.
This fixes https://bugs.llvm.org/show_bug.cgi?id=34278
@zturner I've added this comment.