[lld] r199240 - [Mips] Calculate gp value only once.
Simon Atanasyan
simon at atanasyan.com
Tue Jan 14 10:20:00 PST 2014
Author: atanasyan
Date: Tue Jan 14 12:20:00 2014
New Revision: 199240
URL: http://llvm.org/viewvc/llvm-project?rev=199240&view=rev
Log:
[Mips] Calculate gp value only once.
Modified:
lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp
Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp?rev=199240&r1=199239&r2=199240&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp Tue Jan 14 12:20:00 2014
@@ -169,23 +169,21 @@ void MipsTargetHandler::finalizeSymbolVa
if (_context.isDynamic()) {
auto gotSection = _targetLayout.findOutputSection(".got");
+ auto got = gotSection ? gotSection->virtualAddr() : 0;
+ auto gp = gotSection ? got + _targetLayout.getGPOffset() : 0;
auto gotAtomIter = _targetLayout.findAbsoluteAtom("_GLOBAL_OFFSET_TABLE_");
assert(gotAtomIter != _targetLayout.absoluteAtoms().end());
- (*gotAtomIter)->_virtualAddr = gotSection ? gotSection->virtualAddr() : 0;
+ (*gotAtomIter)->_virtualAddr = got;
auto gpAtomIter = _targetLayout.findAbsoluteAtom("_gp");
assert(gpAtomIter != _targetLayout.absoluteAtoms().end());
- (*gpAtomIter)->_virtualAddr =
- gotSection ? gotSection->virtualAddr() + _targetLayout.getGPOffset()
- : 0;
+ (*gpAtomIter)->_virtualAddr = gp;
auto gpDispAtomIter = _targetLayout.findAbsoluteAtom("_gp_disp");
assert(gpDispAtomIter != _targetLayout.absoluteAtoms().end());
_gpDispSymAtom = (*gpDispAtomIter);
- _gpDispSymAtom->_virtualAddr =
- gotSection ? gotSection->virtualAddr() + _targetLayout.getGPOffset()
- : 0;
+ _gpDispSymAtom->_virtualAddr = gp;
}
}
More information about the llvm-commits
mailing list