[ELF][MIPS] Do not change MipsGotSection state in the getPageEntryOffset method
authorSimon Atanasyan <simon@atanasyan.com>
Tue, 29 Nov 2016 10:23:56 +0000 (10:23 +0000)
committerSimon Atanasyan <simon@atanasyan.com>
Tue, 29 Nov 2016 10:23:56 +0000 (10:23 +0000)
commit9fae3b8a2c0c6a57cfa6b588a96f0dbcb21bd5e3
treeaa653d5bc5409e34ea7031bc4309587621ac99fd
parenta0efc4268c99a2bfe498cf5645d66401a8d2f834
[ELF][MIPS] Do not change MipsGotSection state in the getPageEntryOffset method

The MipsGotSection::getPageEntryOffset calculates index of GOT entry
with a "page" address. Previously this method changes the state
of MipsGotSection because it modifies PageIndexMap field. That leads
to the unpredictable results if getPageEntryOffset called from multiple threads.

The patch makes getPageEntryOffset constant. To do so it calculates GOT
entry index but does not update PageIndexMap field. Later in the
MipsGotSection::writeTo method linker calculates "page" addresses and
writes them to the output.

llvm-svn: 288129
lld/ELF/InputSection.cpp
lld/ELF/SyntheticSections.cpp
lld/ELF/SyntheticSections.h
lld/test/ELF/mips-64-got.s
lld/test/ELF/mips-got-redundant.s
lld/test/ELF/mips-got16.s
lld/test/ELF/mips-xgot-order.s