forked from OSchip/llvm-project
[Mips] Factor out the code assign a value to the absolute atom into the
separate function. llvm-svn: 209593
This commit is contained in:
parent
23fe15a62d
commit
6c68ffe3ef
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue