Don't pass a member variable to a method. NFC.

llvm-svn: 252718
This commit is contained in:
Rafael Espindola 2015-11-11 10:23:32 +00:00
parent 9a6e4632a0
commit 8e37f791f7
2 changed files with 7 additions and 10 deletions

View File

@ -84,8 +84,7 @@ template <class ELFT>
template <bool isRela> template <bool isRela>
void InputSectionBase<ELFT>::relocate( void InputSectionBase<ELFT>::relocate(
uint8_t *Buf, uint8_t *BufEnd, uint8_t *Buf, uint8_t *BufEnd,
iterator_range<const Elf_Rel_Impl<ELFT, isRela> *> Rels, iterator_range<const Elf_Rel_Impl<ELFT, isRela> *> Rels, uintX_t BaseAddr) {
const ObjectFile<ELFT> &File, uintX_t BaseAddr) {
typedef Elf_Rel_Impl<ELFT, isRela> RelType; typedef Elf_Rel_Impl<ELFT, isRela> RelType;
for (const RelType &RI : Rels) { for (const RelType &RI : Rels) {
uint32_t SymIndex = RI.getSymbol(Config->Mips64EL); uint32_t SymIndex = RI.getSymbol(Config->Mips64EL);
@ -103,14 +102,14 @@ void InputSectionBase<ELFT>::relocate(
// Handle relocations for local symbols -- they never get // Handle relocations for local symbols -- they never get
// resolved so we don't allocate a SymbolBody. // resolved so we don't allocate a SymbolBody.
const Elf_Shdr *SymTab = File.getSymbolTable(); const Elf_Shdr *SymTab = File->getSymbolTable();
if (SymIndex < SymTab->sh_info) { if (SymIndex < SymTab->sh_info) {
uintX_t SymVA = getLocalRelTarget(File, RI); uintX_t SymVA = getLocalRelTarget(*File, RI);
Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc, SymVA); Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc, SymVA);
continue; continue;
} }
SymbolBody &Body = *File.getSymbolBody(SymIndex)->repl(); SymbolBody &Body = *File->getSymbolBody(SymIndex)->repl();
uintX_t SymVA = getSymVA<ELFT>(Body); uintX_t SymVA = getSymVA<ELFT>(Body);
if (Target->relocNeedsPlt(Type, Body)) { if (Target->relocNeedsPlt(Type, Body)) {
SymVA = Out<ELFT>::Plt->getEntryAddr(Body); SymVA = Out<ELFT>::Plt->getEntryAddr(Body);
@ -143,11 +142,9 @@ template <class ELFT> void InputSection<ELFT>::writeTo(uint8_t *Buf) {
// Iterate over all relocation sections that apply to this section. // Iterate over all relocation sections that apply to this section.
for (const Elf_Shdr *RelSec : RelocSections) { for (const Elf_Shdr *RelSec : RelocSections) {
if (RelSec->sh_type == SHT_RELA) if (RelSec->sh_type == SHT_RELA)
this->relocate(Base, Base + Data.size(), EObj.relas(RelSec), *this->File, this->relocate(Base, Base + Data.size(), EObj.relas(RelSec), BaseAddr);
BaseAddr);
else else
this->relocate(Base, Base + Data.size(), EObj.rels(RelSec), *this->File, this->relocate(Base, Base + Data.size(), EObj.rels(RelSec), BaseAddr);
BaseAddr);
} }
} }

View File

@ -74,7 +74,7 @@ public:
void relocate(uint8_t *Buf, uint8_t *BufEnd, void relocate(uint8_t *Buf, uint8_t *BufEnd,
llvm::iterator_range< llvm::iterator_range<
const llvm::object::Elf_Rel_Impl<ELFT, isRela> *> Rels, const llvm::object::Elf_Rel_Impl<ELFT, isRela> *> Rels,
const ObjectFile<ELFT> &File, uintX_t BaseAddr); uintX_t BaseAddr);
}; };
template <class ELFT> template <class ELFT>