Add a convenience getObj method. NFC.

llvm-svn: 286370
This commit is contained in:
Rafael Espindola 2016-11-09 14:39:20 +00:00
parent e877baa854
commit 77dbe9a405
3 changed files with 8 additions and 7 deletions

View File

@ -218,8 +218,8 @@ bool ICF<ELFT>::equalsConstant(const InputSection<ELFT> *A,
for (size_t I = 0, E = A->RelocSections.size(); I != E; ++I) {
const Elf_Shdr *RA = A->RelocSections[I];
const Elf_Shdr *RB = B->RelocSections[I];
ELFFile<ELFT> FileA = A->File->getObj();
ELFFile<ELFT> FileB = B->File->getObj();
ELFFile<ELFT> FileA = A->getObj();
ELFFile<ELFT> FileB = B->getObj();
if (RA->sh_type == SHT_RELA) {
if (!relocationEq(check(FileA.relas(RA)), check(FileB.relas(RB))))
return false;
@ -271,8 +271,8 @@ bool ICF<ELFT>::equalsVariable(const InputSection<ELFT> *A,
for (size_t I = 0, E = A->RelocSections.size(); I != E; ++I) {
const Elf_Shdr *RA = A->RelocSections[I];
const Elf_Shdr *RB = B->RelocSections[I];
ELFFile<ELFT> FileA = A->File->getObj();
ELFFile<ELFT> FileB = B->File->getObj();
ELFFile<ELFT> FileA = A->getObj();
ELFFile<ELFT> FileB = B->getObj();
if (RA->sh_type == SHT_RELA) {
if (!variableEq(A, B, check(FileA.relas(RA)), check(FileB.relas(RB))))
return false;

View File

@ -470,9 +470,9 @@ void InputSectionBase<ELFT>::relocate(uint8_t *Buf, uint8_t *BufEnd) {
if (IS && !(IS->Flags & SHF_ALLOC)) {
for (const Elf_Shdr *RelSec : IS->RelocSections) {
if (RelSec->sh_type == SHT_RELA)
IS->relocateNonAlloc(Buf, check(IS->File->getObj().relas(RelSec)));
IS->relocateNonAlloc(Buf, check(IS->getObj().relas(RelSec)));
else
IS->relocateNonAlloc(Buf, check(IS->File->getObj().rels(RelSec)));
IS->relocateNonAlloc(Buf, check(IS->getObj().rels(RelSec)));
}
return;
}
@ -607,7 +607,7 @@ template <class ELFT> void EhInputSection<ELFT>::split() {
return;
if (RelocSection) {
ELFFile<ELFT> Obj = this->File->getObj();
ELFFile<ELFT> Obj = this->getObj();
if (RelocSection->sh_type == SHT_RELA)
split(check(Obj.relas(RelocSection)));
else

View File

@ -119,6 +119,7 @@ public:
static InputSectionBase<ELFT> Discarded;
ObjectFile<ELFT> *getFile() const { return File; }
llvm::object::ELFFile<ELFT> getObj() const { return File->getObj(); }
uintX_t getOffset(const DefinedRegular<ELFT> &Sym) const;
InputSectionBase *getLinkOrderDep() const;
// Translate an offset in the input section to an offset in the output