[all-commits] [llvm/llvm-project] 4d2eda: Revert "[LLD] [COFF] Use StringTableBuilder to opt...

Martin Storsjö via All-commits all-commits at lists.llvm.org
Tue Jun 21 03:25:22 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4d2eda2bb3156cee63ea486be34b01164b178e10
  Author: Martin Storsjö <martin at martin.st>
  Date:   2022-06-21 (Tue, 21 Jun 2022)

  Changed paths:
    M lld/COFF/Writer.cpp

  Log Message:
  Revert "[LLD] [COFF] Use StringTableBuilder to optimize the string table"

This reverts commit 9ffeaaa0ea54307db309104696a0b6cce6ddda38.

This fixes debugging large executables with lldb and gdb.

When StringTableBuilder is used, the string offsets for any string
can point anywhere in the string table - while previously, all strings
were inserted in order (without deduplication and tail merging).

For symbols, there's no complications in encoding the string offset;
the offset is encoded as a raw 32 bit binary number in half of the
symbol name field.

For sections, the string table offset is written as
"/<decimaloffset>", but if the decimal offset would be larger than
7 digits, it's instead written as "//<base64offset>". Tools that
operate on object files can handle the base64 offset format, but
apparently neither lldb nor gdb expect that syntax when locating the
debug information section. Prior to the reverted commit, all long
section names were located at the start of the string table, so
their offset never exceeded the range for the decimal syntax.

Just reverting this change for now, as the actual benefit from it
was fairly modest.

Longer term, lld could write all long section names unoptimized
at the start of the string table, followed by all the strings for
symbol names, with deduplication and tail merging. And lldb and
gdb could be fixed to handle sections with the base64 offset syntax.

This fixes https://github.com/mstorsjo/llvm-mingw/issues/289.

More information about the All-commits mailing list