[COFF] When doing automatic dll imports, replace whole .refptr.<var> chunks with...
authorMartin Storsjo <martin@martin.st>
Fri, 31 Aug 2018 07:45:20 +0000 (07:45 +0000)
committerMartin Storsjo <martin@martin.st>
Fri, 31 Aug 2018 07:45:20 +0000 (07:45 +0000)
commit802fcb4167a309dc5a10af14d1a1aaf5a2c625de
tree5624816b41a6f6a53b88e4b9825635ae880228c1
parent83e9f928ba28b7bc6dd6a7f1a255a59f8b6785a8
[COFF] When doing automatic dll imports, replace whole .refptr.<var> chunks with __imp_<var>

After fixing up the runtime pseudo relocation, the .refptr.<var>
will be a plain pointer with the same value as the IAT entry itself.
To save a little binary size and reduce the number of runtime pseudo
relocations, redirect references to the IAT entry (via the __imp_<var>
symbol) itself and discard the .refptr.<var> chunk (as long as the
same section chunk doesn't contain anything else than the single
pointer).

As there are now cases for both setting the Live variable to true
and false externally, remove the accessors and setters and just make
the variable public instead.

Differential Revision: https://reviews.llvm.org/D51456

llvm-svn: 341175
lld/COFF/Chunks.cpp
lld/COFF/Chunks.h
lld/COFF/ICF.cpp
lld/COFF/MarkLive.cpp
lld/COFF/PDB.cpp
lld/COFF/SymbolTable.cpp
lld/COFF/Symbols.cpp
lld/COFF/Writer.cpp
lld/test/COFF/autoimport-refptr.s [new file with mode: 0644]