From 00d8843fa39e917882023c54f43eb4b77c113e4c Mon Sep 17 00:00:00 2001 From: Simon Atanasyan Date: Mon, 11 Jun 2018 08:37:19 +0000 Subject: [ELF] Pass a pointer to InputFile to the getRelocTargetVA to escape dereferencing of nullptr. NFC llvm-svn: 334392 --- lld/ELF/SyntheticSections.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'lld/ELF/SyntheticSections.cpp') diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp index cd0d3fe525c..4195ed9a2e8 100644 --- a/lld/ELF/SyntheticSections.cpp +++ b/lld/ELF/SyntheticSections.cpp @@ -708,10 +708,10 @@ MipsGotSection::FileGot &MipsGotSection::getGot(InputFile &F) { return Gots[*F.MipsGotIndex]; } -uint64_t MipsGotSection::getPageEntryOffset(const InputFile &F, +uint64_t MipsGotSection::getPageEntryOffset(const InputFile *F, const Symbol &Sym, int64_t Addend) const { - const FileGot &G = Gots[*F.MipsGotIndex]; + const FileGot &G = Gots[*F->MipsGotIndex]; uint64_t Index = 0; if (const OutputSection *OutSec = Sym.getOutputSection()) { uint64_t SecAddr = getMipsPageAddr(OutSec->Addr); @@ -723,9 +723,9 @@ uint64_t MipsGotSection::getPageEntryOffset(const InputFile &F, return Index * Config->Wordsize; } -uint64_t MipsGotSection::getSymEntryOffset(const InputFile &F, const Symbol &S, +uint64_t MipsGotSection::getSymEntryOffset(const InputFile *F, const Symbol &S, int64_t Addend) const { - const FileGot &G = Gots[*F.MipsGotIndex]; + const FileGot &G = Gots[*F->MipsGotIndex]; Symbol *Sym = const_cast(&S); if (Sym->isTls()) return G.Tls.find(Sym)->second * Config->Wordsize; @@ -734,14 +734,14 @@ uint64_t MipsGotSection::getSymEntryOffset(const InputFile &F, const Symbol &S, return G.Local16.find({Sym, Addend})->second * Config->Wordsize; } -uint64_t MipsGotSection::getTlsIndexOffset(const InputFile &F) const { - const FileGot &G = Gots[*F.MipsGotIndex]; +uint64_t MipsGotSection::getTlsIndexOffset(const InputFile *F) const { + const FileGot &G = Gots[*F->MipsGotIndex]; return G.DynTlsSymbols.find(nullptr)->second * Config->Wordsize; } -uint64_t MipsGotSection::getGlobalDynOffset(const InputFile &F, +uint64_t MipsGotSection::getGlobalDynOffset(const InputFile *F, const Symbol &S) const { - const FileGot &G = Gots[*F.MipsGotIndex]; + const FileGot &G = Gots[*F->MipsGotIndex]; Symbol *Sym = const_cast(&S); return G.DynTlsSymbols.find(Sym)->second * Config->Wordsize; } -- cgit v1.2.3