diff options
| author | Martin Storsjo <martin@martin.st> | 2018-08-31 07:45:20 +0000 |
|---|---|---|
| committer | Martin Storsjo <martin@martin.st> | 2018-08-31 07:45:20 +0000 |
| commit | 802fcb4167a309dc5a10af14d1a1aaf5a2c625de (patch) | |
| tree | 5624816b41a6f6a53b88e4b9825635ae880228c1 /lld/COFF/Writer.cpp | |
| parent | 83e9f928ba28b7bc6dd6a7f1a255a59f8b6785a8 (diff) | |
| download | bcm5719-llvm-802fcb4167a309dc5a10af14d1a1aaf5a2c625de.tar.gz bcm5719-llvm-802fcb4167a309dc5a10af14d1a1aaf5a2c625de.zip | |
[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
Diffstat (limited to 'lld/COFF/Writer.cpp')
| -rw-r--r-- | lld/COFF/Writer.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lld/COFF/Writer.cpp b/lld/COFF/Writer.cpp index 5f87f0e2955..ff929018eef 100644 --- a/lld/COFF/Writer.cpp +++ b/lld/COFF/Writer.cpp @@ -435,7 +435,7 @@ void Writer::createSections() { std::map<std::pair<StringRef, uint32_t>, std::vector<Chunk *>> Map; for (Chunk *C : Symtab->getChunks()) { auto *SC = dyn_cast<SectionChunk>(C); - if (SC && !SC->isLive()) { + if (SC && !SC->Live) { if (Config->Verbose) SC->printDiscardedMessage(); continue; @@ -1014,7 +1014,7 @@ static void markSymbolsWithRelocations(ObjFile *File, // We only care about live section chunks. Common chunks and other chunks // don't generally contain relocations. SectionChunk *SC = dyn_cast<SectionChunk>(C); - if (!SC || !SC->isLive()) + if (!SC || !SC->Live) continue; for (const coff_relocation &Reloc : SC->Relocs) { @@ -1097,7 +1097,7 @@ void Writer::markSymbolsForRVATable(ObjFile *File, // is associated with something like a vtable and the vtable is discarded. // In this case, the associated gfids section is discarded, and we don't // mark the virtual member functions as address-taken by the vtable. - if (!C->isLive()) + if (!C->Live) continue; // Validate that the contents look like symbol table indices. @@ -1153,7 +1153,7 @@ void Writer::createRuntimePseudoRelocs() { for (Chunk *C : Symtab->getChunks()) { auto *SC = dyn_cast<SectionChunk>(C); - if (!SC || !SC->isLive()) + if (!SC || !SC->Live) continue; SC->getRuntimePseudoRelocs(Rels); } |

