[LLD][COFF] When using PCH.OBJ, ensure func_id records indices are remapped under...
authorAlexandre Ganea <alexandre.ganea@ubisoft.com>
Thu, 7 Jan 2021 21:32:47 +0000 (16:32 -0500)
committerAlexandre Ganea <alexandre.ganea@ubisoft.com>
Thu, 7 Jan 2021 22:27:13 +0000 (17:27 -0500)
commiteaadb41db6233cf1c9e882d74a31c1f9d6e211ff
tree8a5f299985265cd21ee8c2bb7eea302d395a6b0c
parent973c35d3384ace023000eb44442f86a2543ab9eb
[LLD][COFF] When using PCH.OBJ, ensure func_id records indices are remapped under /DEBUG:GHASH

Before this patch, when using LLD with /DEBUG:GHASH and MSVC precomp.OBJ files, we had a bunch of:

lld-link: warning: S_[GL]PROC32ID record in blabla.obj refers to PDB item index 0x206ED1 which is not a LF[M]FUNC_ID record

This was caused by LF_FUNC_ID and LF_MFUNC_ID which didn't have correct mapping to the corresponding TPI records. The root issue was that the indexMapStorage was improperly re-assembled in UsePrecompSource::remapTpiWithGHashes.

After this patch, /DEBUG and /DEBUG:GHASH produce exactly the same debug infos in the PDB.

Differential Revision: https://reviews.llvm.org/D93732
lld/COFF/DebugTypes.cpp
lld/test/COFF/Inputs/precomp-ghash-obj1.obj [new file with mode: 0644]
lld/test/COFF/Inputs/precomp-ghash-obj2.obj [new file with mode: 0644]
lld/test/COFF/Inputs/precomp-ghash-precomp.obj [new file with mode: 0644]
lld/test/COFF/precomp-ghash.test [new file with mode: 0644]