[lld] r331555 - [ELF][MIPS] Reorganize isMipsPIC routine. NFC
Simon Atanasyan via llvm-commits
llvm-commits at lists.llvm.org
Fri May 4 13:48:53 PDT 2018
Author: atanasyan
Date: Fri May 4 13:48:53 2018
New Revision: 331555
URL: http://llvm.org/viewvc/llvm-project?rev=331555&view=rev
Log:
[ELF][MIPS] Reorganize isMipsPIC routine. NFC
Modified:
lld/trunk/ELF/Arch/Mips.cpp
Modified: lld/trunk/ELF/Arch/Mips.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Arch/Mips.cpp?rev=331555&r1=331554&r2=331555&view=diff
==============================================================================
--- lld/trunk/ELF/Arch/Mips.cpp (original)
+++ lld/trunk/ELF/Arch/Mips.cpp Fri May 4 13:48:53 2018
@@ -658,18 +658,21 @@ template <class ELFT> bool MIPS<ELFT>::u
// Return true if the symbol is a PIC function.
template <class ELFT> bool elf::isMipsPIC(const Defined *Sym) {
- typedef typename ELFT::Ehdr Elf_Ehdr;
- if (!Sym->Section || !Sym->isFunc())
+ if (!Sym->isFunc())
return false;
- auto *Sec = cast<InputSectionBase>(Sym->Section);
- ObjFile<ELFT> *File = Sec->template getFile<ELFT>();
+ if (Sym->StOther & STO_MIPS_PIC)
+ return true;
+
+ if (!Sym->Section)
+ return false;
+
+ ObjFile<ELFT> *File =
+ cast<InputSectionBase>(Sym->Section)->template getFile<ELFT>();
if (!File)
return false;
- const Elf_Ehdr *Hdr = File->getObj().getHeader();
- return (Sym->StOther & STO_MIPS_MIPS16) == STO_MIPS_PIC ||
- (Hdr->e_flags & EF_MIPS_PIC);
+ return File->getObj().getHeader()->e_flags & EF_MIPS_PIC;
}
template <class ELFT> TargetInfo *elf::getMipsTargetInfo() {
More information about the llvm-commits
mailing list