This is an archive of the discontinued LLVM Phabricator instance.

[LLD][COFF] When using PCH.OBJ, ensure func_id records indices are remapped under /DEBUG:GHASH
ClosedPublic

Authored by aganea on Dec 22 2020, 2:14 PM.

Details

Summary

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.

Diff Detail

Event Timeline

aganea requested review of this revision.Dec 22 2020, 2:14 PM
aganea created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptDec 22 2020, 2:14 PM
rnk accepted this revision.Jan 5 2021, 5:00 PM

lgtm

The Harbormaster precommit test stuff is complaining, but maybe it's just because of the binary files in the patch.

lld/COFF/DebugTypes.cpp
1150–1153

I think this is ripe for some follow-on simplifications. I believe mapToFill is always just indexMapStorage. This routine is really rewriting ghash cell indices to PDB type indices.

This revision is now accepted and ready to land.Jan 5 2021, 5:00 PM
aganea added a comment.Jan 5 2021, 5:40 PM

Thanks for looking at this!

lld/COFF/DebugTypes.cpp
1150–1153

Yes indeed, I made that change locally, I could commit a NFC patch after landing this.

This revision was landed with ongoing or failed builds.Jan 7 2021, 2:27 PM
This revision was automatically updated to reflect the committed changes.