[PATCH] D33520: Garbage collect dllimported symbols.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 24 14:42:03 PDT 2017


ruiu created this revision.

This is a different implementation than r303225 (which was reverted
in r303270, re-submitted in r303304 and then re-reverted in r303527).

In the previous patch, I tried to add Live bit to each dllimported
symbol. It turned out that it didn't work with "oldnames.lib" which
contains a lot of weak aliases to dllimported symbols.

The way we handle dllimported symobls is to check if undefined symbols
can be resolved using weak aliases, and if so, memcpy the Defined
symbols to weak Undefined symbols, so that any references to weak
aliases automatically see defined symbols instead of undefined ones.

This memcpy happens before MarkLive kicks in.

That means we may have multiple copies of dllimported symbols. So
turning on one instance's Live bit is not enough.

This patch moves the Live bit to dllimport file. Since multiple
copies of dllsymbols still point to the same file, we can use it as the
central repository to keep track of liveness.


https://reviews.llvm.org/D33520

Files:
  lld/COFF/InputFiles.h
  lld/COFF/MarkLive.cpp
  lld/COFF/Symbols.cpp
  lld/COFF/Symbols.h
  lld/COFF/Writer.cpp
  lld/test/COFF/Inputs/import.yaml
  lld/test/COFF/dllimport-gc.test

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33520.100165.patch
Type: text/x-patch
Size: 7608 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170524/a3492250/attachment.bin>


More information about the llvm-commits mailing list