[PATCH] D59025: Add --add-ghashes to llvm-objcopy to append a .debug$H to coff objects

Alexandre Ganea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 20 06:38:03 PDT 2019


aganea added a comment.

In D59025#1436238 <https://reviews.llvm.org/D59025#1436238>, @santagada wrote:

> Just discovered this doesn't work when using a pch... it gets into an infinite loop trying to hash types, the reason I think that there are types in the .debug$T asking for indexes on the .debug$T of the pch. Somehow I need to fix this... just don't know how yet


Yeah PCH OBJs are a bit tricker. You need to first hash the PCH.OBJ (compiled with /Yc), and make it available in memory, along with the dependent OBJ (compiled with /Yc) that you want to hash.
Just before hashing the /Yc OBJ, you need to replace the first LF_PRECOMP record with the `.debug$P` stream (which is a `.debug$T` in disguise). It is only then that you can hash the rest of the /Yc OBJ (you won't need to re-hash the PCH.OBJ stream again).

You can check <https://github.com/llvm/llvm-project/blob/master/lld/COFF/PDB.cpp#L618> `PDBLinker::mergeInPrecompHeaderObj()` to see how things are done in that regards in LLD.
I am currently refactoring <https://reviews.llvm.org/D59226> all that code to make it suitable for parallelization. I'll see if we can raise it at a higher level into llvm/trunk/llvm/lib/DebugInfo/CodeView <https://github.com/llvm/llvm-project/tree/master/llvm/lib/DebugInfo/CodeView>

Can you wait a bit until all this goes through?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59025/new/

https://reviews.llvm.org/D59025





More information about the llvm-commits mailing list