[ELF][MIPS] Reduce number of redundant entries in the local part of MIPS GOT
authorSimon Atanasyan <simon@atanasyan.com>
Tue, 29 Mar 2016 14:07:22 +0000 (14:07 +0000)
committerSimon Atanasyan <simon@atanasyan.com>
Tue, 29 Mar 2016 14:07:22 +0000 (14:07 +0000)
commitd2980d3e206ef385a4491673bf90dbb73eab80aa
tree620326834c13a3dffb9d83b51bc36b3549d2706c
parenteb0c5c8776498f8644bf55cf35e1d86d2b44e428
[ELF][MIPS] Reduce number of redundant entries in the local part of MIPS GOT

Local symbol which requires GOT entry initialized by "page" address.
This address is high 16 bits of sum of the symbol value and the relocation
addend. In the relocation scanning phase final values of symbols are unknown
so to reduce number of allocated GOT entries do the following trick. Save
all output sections referenced by GOT relocations during the relocation
scanning phase. Then later in the `GotSection::finalize` method calculate
number of "pages" required to cover all saved output sections and allocate
appropriate number of GOT entries. We assume the worst case - each 64kb
page of the output section has at least one GOT relocation against it.

Differential Revision: http://reviews.llvm.org/D18349

llvm-svn: 264730
lld/ELF/OutputSections.cpp
lld/ELF/OutputSections.h
lld/test/ELF/mips-got-redundant.s