diff options
| author | Simon Atanasyan <simon@atanasyan.com> | 2018-05-04 20:48:53 +0000 |
|---|---|---|
| committer | Simon Atanasyan <simon@atanasyan.com> | 2018-05-04 20:48:53 +0000 |
| commit | b6211d9084e13d892faa6c7020561d9193b5513f (patch) | |
| tree | 3a908a0ab2b88f5f7ef4e29618ad8e715f07656f | |
| parent | 86a1219d3033ef2a5cf5fe1e42578a9ffbd10a34 (diff) | |
| download | bcm5719-llvm-b6211d9084e13d892faa6c7020561d9193b5513f.tar.gz bcm5719-llvm-b6211d9084e13d892faa6c7020561d9193b5513f.zip | |
[ELF][MIPS] Reorganize isMipsPIC routine. NFC
llvm-svn: 331555
| -rw-r--r-- | lld/ELF/Arch/Mips.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lld/ELF/Arch/Mips.cpp b/lld/ELF/Arch/Mips.cpp index 51ecb8bf30d..f2a1aea1bb5 100644 --- a/lld/ELF/Arch/Mips.cpp +++ b/lld/ELF/Arch/Mips.cpp @@ -658,18 +658,21 @@ template <class ELFT> bool MIPS<ELFT>::usesOnlyLowPageBits(RelType Type) const { // 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() { |

