[PATCH] D45213: [COFF][LLD] Add link support for precompiled headers .objs

Alexandre Ganea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 3 09:42:43 PDT 2018


aganea created this revision.
aganea added reviewers: zturner, ruiu, rnk.
Herald added subscribers: llvm-commits, hiraditya.

This change adds the ability for link-time merging of debugging information
coming from precompiled headers objects compiled with cl.exe /Z7 /Yc and /Yu.

Previously, LLD used to crash when encountering these .objs on the command line.

The change essentially adds support for handling of LF_PRECOMP and LF_ENDPRECOMP
records. LF_PRECOMP appears in a .obj that *refers to* a precompiled obj. And
LF_ENDPRECOMP appears in a precompiled .obj, and indicates where the referred
type stream must end.

When an .obj with a LF_PRECOMP reference is found, we preempt the processing of
that .obj, and attempt to first load the precompiled .obj. This is required in
order to be able to process the first .obj. Once the precompiled .obj is loaded
and remapped, we simply take its (remapped) type stream and *paste* it in the
TypeStreamMerger, before merging in the first .obj's type stream. This allows
for back-referencing type records.

This fixes https://bugs.llvm.org/show_bug.cgi?id=34278


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D45213

Files:
  lld/COFF/InputFiles.h
  lld/COFF/PDB.cpp
  lld/test/COFF/Inputs/precomp-a.yaml
  lld/test/COFF/Inputs/precomp-b.yaml
  lld/test/COFF/Inputs/precomp-precomp.yaml
  lld/test/COFF/precomp.test
  llvm/include/llvm/DebugInfo/CodeView/CodeViewTypes.def
  llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h
  llvm/include/llvm/DebugInfo/CodeView/TypeStreamMerger.h
  llvm/include/llvm/DebugInfo/PDB/GenericError.h
  llvm/lib/DebugInfo/CodeView/RecordName.cpp
  llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp
  llvm/lib/DebugInfo/CodeView/TypeDumpVisitor.cpp
  llvm/lib/DebugInfo/CodeView/TypeRecordMapping.cpp
  llvm/lib/DebugInfo/CodeView/TypeStreamMerger.cpp
  llvm/lib/DebugInfo/PDB/GenericError.cpp
  llvm/lib/ObjectYAML/CodeViewYAMLTypes.cpp
  llvm/tools/llvm-pdbutil/MinimalTypeDumper.cpp
  llvm/tools/llvm-readobj/COFFDumper.cpp
  llvm/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45213.140813.patch
Type: text/x-patch
Size: 222860 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180403/3da8a17e/attachment-0001.bin>


More information about the llvm-commits mailing list