Simplify mips got handling.
This avoids computing the address of a position in the got just to then
subtract got->getva().
llvm-svn: 266831
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp
index 96505b2..08fed9a 100644
--- a/lld/ELF/OutputSections.cpp
+++ b/lld/ELF/OutputSections.cpp
@@ -165,19 +165,19 @@
template <class ELFT>
typename GotSection<ELFT>::uintX_t
-GotSection<ELFT>::getMipsLocalPageAddr(uintX_t EntryValue) {
+GotSection<ELFT>::getMipsLocalPageOffset(uintX_t EntryValue) {
// Initialize the entry by the %hi(EntryValue) expression
// but without right-shifting.
- return getMipsLocalEntryAddr((EntryValue + 0x8000) & ~0xffff);
+ return getMipsLocalEntryOffset((EntryValue + 0x8000) & ~0xffff);
}
template <class ELFT>
typename GotSection<ELFT>::uintX_t
-GotSection<ELFT>::getMipsLocalEntryAddr(uintX_t EntryValue) {
+GotSection<ELFT>::getMipsLocalEntryOffset(uintX_t EntryValue) {
size_t NewIndex = Target->GotHeaderEntriesNum + MipsLocalGotPos.size();
auto P = MipsLocalGotPos.insert(std::make_pair(EntryValue, NewIndex));
assert(!P.second || MipsLocalGotPos.size() <= MipsLocalEntries);
- return this->getVA() + P.first->second * sizeof(uintX_t);
+ return P.first->second * sizeof(uintX_t) - MipsGPOffset;
}
template <class ELFT>