From 4360be5d2679925f03ab3253237cac18cf524ae4 Mon Sep 17 00:00:00 2001 From: Simon Atanasyan Date: Wed, 24 Dec 2014 12:19:30 +0000 Subject: [PATCH] [Mips] Factor out the code checks a symbol's binding No functional changes. llvm-svn: 224815 --- lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.h b/lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.h index 71bf3680ca98..c92b29f752dc 100644 --- a/lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.h +++ b/lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.h @@ -215,13 +215,10 @@ private: switch (rel.getType(isMips64EL())) { case llvm::ELF::R_MIPS_HI16: return llvm::ELF::R_MIPS_LO16; - case llvm::ELF::R_MIPS_GOT16: { - const Elf_Sym *symbol = - this->_objFile->getSymbol(rel.getSymbol(isMips64EL())); - if (symbol->getBinding() == llvm::ELF::STB_LOCAL) + case llvm::ELF::R_MIPS_GOT16: + if (isLocalBinding(rel)) return llvm::ELF::R_MIPS_LO16; } - } return llvm::ELF::R_MIPS_NONE; } @@ -234,6 +231,10 @@ private: } bool isMips64EL() const { return this->_objFile->isMips64EL(); } + bool isLocalBinding(const Elf_Rel &rel) { + return this->_objFile->getSymbol(rel.getSymbol(isMips64EL())) + ->getBinding() == llvm::ELF::STB_LOCAL; + } }; template class MipsDynamicFile : public DynamicFile {