[ELF] - Evaluate addend earlier and use it instead getAddend() calls. NFC.

llvm-svn: 263226
This commit is contained in:
George Rimar 2016-03-11 12:53:17 +00:00
parent 87d9f10733
commit 1d9738c2d1
1 changed files with 3 additions and 6 deletions

View File

@ -182,6 +182,7 @@ void InputSectionBase<ELFT>::relocate(uint8_t *Buf, uint8_t *BufEnd,
uint32_t SymIndex = RI.getSymbol(Config->Mips64EL);
uint32_t Type = RI.getType(Config->Mips64EL);
uintX_t Offset = getOffset(RI.r_offset);
uintX_t A = getAddend<ELFT>(RI);
if (Offset == (uintX_t)-1)
continue;
@ -192,8 +193,7 @@ void InputSectionBase<ELFT>::relocate(uint8_t *Buf, uint8_t *BufEnd,
if (Target->pointsToLocalDynamicGotEntry(Type) &&
!Target->canRelaxTls(Type, nullptr)) {
Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc,
Out<ELFT>::Got->getTlsIndexVA() +
getAddend<ELFT>(RI));
Out<ELFT>::Got->getTlsIndexVA() + A);
continue;
}
@ -214,8 +214,6 @@ void InputSectionBase<ELFT>::relocate(uint8_t *Buf, uint8_t *BufEnd,
continue;
}
uintX_t A = getAddend<ELFT>(RI);
// PPC64 has a special relocation representing the TOC base pointer
// that does not have a corresponding symbol.
if (Config->EMachine == EM_PPC64 && RI.getType(false) == R_PPC64_TOC) {
@ -258,8 +256,7 @@ void InputSectionBase<ELFT>::relocate(uint8_t *Buf, uint8_t *BufEnd,
if (Target->isTlsGlobalDynamicRel(Type) &&
!Target->canRelaxTls(Type, &Body)) {
Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc,
Out<ELFT>::Got->getGlobalDynAddr(Body) +
getAddend<ELFT>(RI));
Out<ELFT>::Got->getGlobalDynAddr(Body) + A);
continue;
}