[PATCH] D44504: COFF: Implement string tail merging.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 14 17:39:03 PDT 2018


pcc created this revision.
pcc added a reviewer: ruiu.

In COFF, duplicate string literals are merged by placing them in a
comdat whose leader symbol name contains a specific prefix followed
by the hash and partial contents of the string literal. This gives
us an easy way to identify sections containing string literals in
the linker: check for leader symbol names with the given prefix.

Any sections that are identified in this way as containing string
literals may be tail merged. We do so using the StringTableBuilder
class, which is also used to tail merge string literals in the ELF
linker. Tail merging is enabled only if ICF is enabled, as this
provides a signal as to whether the user cares about binary size.

Depends on https://reviews.llvm.org/D44501


https://reviews.llvm.org/D44504

Files:
  lld/COFF/Chunks.cpp
  lld/COFF/Chunks.h
  lld/COFF/ICF.cpp
  lld/COFF/InputFiles.cpp
  lld/COFF/InputFiles.h
  lld/COFF/Writer.cpp
  lld/test/COFF/string-tail-merge.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44504.138479.patch
Type: text/x-patch
Size: 9302 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180315/48e2af5f/attachment.bin>


More information about the llvm-commits mailing list