This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo][PDB] Don't write empty debug streams
ClosedPublic

Authored by aganea on Mar 18 2019, 11:38 AM.

Details

Summary

Before, empty debug streams were written as 8 bytes (4 bytes signature + 4 bytes for the GlobalRefs count), see here.

With this patch, unused empty streams aren't emitted anymore. Modules now encode 65535 as an 'unused stream' value, by convention.
Also fix the * Linker * contrib section which wasn't correctly emitted previously.

As a side-effect, MinGW PDBs are now much smaller. Tested with Martin's dataset, using lld-link @response.txt /debug
libqt_plugin.pdb:

trunk21 MB
this patch13.3 MB

This was previously caused by the large amount of MinGW sections which create a separate module, each with its own debug stream:

                          Summary                           
============================================================
  Block Size: 4096
  Number of blocks: 5491
  Number of streams: 2151 <----------
  Signature: 382173742
  Age: 1
  GUID: {2E82C716-1297-3F14-4C4C-44205044422E}
  Features: 0x0
  Has Debug Info: true
  Has Types: true
  Has IDs: false
  Has Globals: true
  Has Publics: true
  Is incrementally linked: false
  Has conflicting types: false
  Is stripped: false
...
  Stream   13 (      8 bytes): [Module "C:\Users\aganea\Downloads\vlc-qt-plugin-repro\home\martin\fate\vlc\src\build-x86_64\modules\gui\qt\.libs\libqt_plugin_la-qt.o"]
               Blocks: [1775]
...
Mod 0003 | `C:\Users\aganea\Downloads\vlc-qt-plugin-repro\home\martin\fate\vlc\src\build-x86_64\modules\gui\qt\.libs\libqt_plugin_la-qt.o`: 
  Stream 13, 8 bytes
  
    Symbols
                                       Total:       0 entries (       0 bytes)
    --------------------------------------------------------------------------
  
    Chunks
                                       Total:       0 entries (       0 bytes)
    --------------------------------------------------------------------------

With this patch:

                          Summary                           
============================================================
  Block Size: 4096
  Number of blocks: 3397
  Number of streams: 45 <----------
  Signature: 4031447796
  Age: 1
  GUID: {F4024BF0-D475-9E33-4C4C-44205044422E}
  Features: 0x0
  Has Debug Info: true
  Has Types: true
  Has IDs: false
  Has Globals: true
  Has Publics: true
  Is incrementally linked: false
  Has conflicting types: false
  Is stripped: false
...
Mod 0003 | `C:\Users\aganea\Downloads\vlc-qt-plugin-repro\home\martin\fate\vlc\src\build-x86_64\modules\gui\qt\.libs\libqt_plugin_la-qt.o`: 
  Mod    3 (debug info not present): [C:\Users\aganea\Downloads\vlc-qt-plugin-repro\home\martin\fate\vlc\src\build-x86_64\modules\gui\qt\.libs\libqt_plugin_la-qt.o]

Diff Detail

Repository
rLLD LLVM Linker

Event Timeline

aganea created this revision.Mar 18 2019, 11:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 18 2019, 11:38 AM
zturner accepted this revision.Mar 18 2019, 11:42 AM
This revision is now accepted and ready to land.Mar 18 2019, 11:42 AM
This revision was automatically updated to reflect the committed changes.