[lld] r209593 - [Mips] Factor out the code assign a value to the absolute atom into the
Simon Atanasyan
simon at atanasyan.com
Sun May 25 02:05:07 PDT 2014
Author: atanasyan
Date: Sun May 25 04:05:06 2014
New Revision: 209593
URL: http://llvm.org/viewvc/llvm-project?rev=209593&view=rev
Log:
[Mips] Factor out the code assign a value to the absolute atom into the
separate function.
Modified:
lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFWriters.h
Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFWriters.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFWriters.h?rev=209593&r1=209592&r2=209593&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFWriters.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFWriters.h Sun May 25 04:05:06 2014
@@ -49,17 +49,9 @@ public:
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 = got;
-
- auto gpAtomIter = _targetLayout.findAbsoluteAtom("_gp");
- assert(gpAtomIter != _targetLayout.absoluteAtoms().end());
- (*gpAtomIter)->_virtualAddr = gp;
-
- AtomLayout *gpAtom = _targetLayout.getGP();
- assert(gpAtom != nullptr);
- gpAtom->_virtualAddr = gp;
+ setAtomValue("_GLOBAL_OFFSET_TABLE_", got);
+ setAtomValue("_gp", gp);
+ setAtomValue("_gp_disp", gp);
}
bool hasGlobalGOTEntry(const Atom *a) const {
@@ -79,6 +71,12 @@ public:
private:
MipsLinkingContext &_context;
MipsTargetLayout<ELFT> &_targetLayout;
+
+ void setAtomValue(StringRef name, uint64_t value) {
+ auto atom = _targetLayout.findAbsoluteAtom(name);
+ assert(atom != _targetLayout.absoluteAtoms().end());
+ (*atom)->_virtualAddr = value;
+ }
};
} // elf
More information about the llvm-commits
mailing list