[lld] r241342 - [Mips] Factor out symbol type checking (PIC/non-PIC) into the separate function

Simon Atanasyan simon at atanasyan.com
Fri Jul 3 04:36:55 PDT 2015


Author: atanasyan
Date: Fri Jul  3 06:36:55 2015
New Revision: 241342

URL: http://llvm.org/viewvc/llvm-project?rev=241342&view=rev
Log:
[Mips] Factor out symbol type checking (PIC/non-PIC) into the separate function

No functional changes.

Modified:
    lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.cpp
    lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h
    lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp

Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.cpp?rev=241342&r1=241341&r2=241342&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.cpp Fri Jul  3 06:36:55 2015
@@ -45,6 +45,11 @@ DefinedAtom::CodeModel MipsELFDefinedAto
   }
 }
 
+template <class ELFT> bool MipsELFDefinedAtom<ELFT>::isPIC() const {
+  return file().isPIC() || codeModel() == DefinedAtom::codeMipsMicroPIC ||
+         codeModel() == DefinedAtom::codeMipsPIC;
+}
+
 template class MipsELFDefinedAtom<ELF32LE>;
 template class MipsELFDefinedAtom<ELF64LE>;
 

Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h?rev=241342&r1=241341&r2=241342&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h Fri Jul  3 06:36:55 2015
@@ -33,6 +33,8 @@ public:
 
   const MipsELFFile<ELFT>& file() const override;
   DefinedAtom::CodeModel codeModel() const override;
+
+  bool isPIC() const;
 };
 
 template <class ELFT> class MipsELFReference : public ELFReference<ELFT> {

Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp?rev=241342&r1=241341&r2=241342&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp Fri Jul  3 06:36:55 2015
@@ -798,7 +798,7 @@ bool RelocationPass<ELFT>::mightBeDynami
     return true;
   if (!isMipsReadonly(atom))
     return true;
-  if (atom.file().isPIC())
+  if (atom.isPIC())
     return true;
 
   return false;
@@ -957,9 +957,7 @@ bool RelocationPass<ELFT>::requireLA25St
   if (atom.file().isPIC())
     return false;
   if (auto *da = dyn_cast<DefinedAtom>(ref.target()))
-    return static_cast<const MipsELFDefinedAtom<ELFT> *>(da)->file().isPIC() ||
-           da->codeModel() == DefinedAtom::codeMipsMicroPIC ||
-           da->codeModel() == DefinedAtom::codeMipsPIC;
+    return static_cast<const MipsELFDefinedAtom<ELFT> *>(da)->isPIC();
   return false;
 }
 





More information about the llvm-commits mailing list