Lines Matching defs:pReloc

185 MipsRelocator::applyRelocation(Relocation& pReloc)
190 if (NULL == m_CurrentLo16Reloc && isPostponed(pReloc)) {
191 postponeRelocation(pReloc);
195 for (MipsRelocationInfo info(pReloc, isRel());
208 pReloc.target() &= ~mask;
209 pReloc.target() |= info.result() & mask;
226 void MipsRelocator::scanRelocation(Relocation& pReloc,
233 ResolveInfo* rsym = pReloc.symInfo();
245 for (MipsRelocationInfo info(pReloc, isRel());
256 getTarget().addNonPICBranchSym(pReloc.symInfo());
262 issueUndefRef(pReloc, pSection, pInput);
291 void MipsRelocator::scanLocalReloc(MipsRelocationInfo& pReloc,
295 ResolveInfo* rsym = pReloc.parent().symInfo();
297 switch (pReloc.type()){
346 pReloc.type(), pReloc.A())) {
372 fatal(diag::unknown_relocation) << (int)pReloc.type() << rsym->name();
376 void MipsRelocator::scanGlobalReloc(MipsRelocationInfo& pReloc,
380 ResolveInfo* rsym = pReloc.parent().symInfo();
382 switch (pReloc.type()){
401 if (getTarget().symbolNeedsCopyReloc(pReloc.parent(), *rsym)) {
428 fatal(diag::invalid_global_relocation) << (int)pReloc.type()
470 fatal(diag::dynamic_relocation) << (int)pReloc.type();
473 fatal(diag::unknown_relocation) << (int)pReloc.type() << rsym->name();
477 bool MipsRelocator::isPostponed(const Relocation& pReloc) const
479 if (MipsRelocationInfo::HasSubType(pReloc, llvm::ELF::R_MIPS_HI16))
482 if (MipsRelocationInfo::HasSubType(pReloc, llvm::ELF::R_MIPS_GOT16) &&
483 pReloc.symInfo()->isLocal())
562 void MipsRelocator::postponeRelocation(Relocation& pReloc)
564 ResolveInfo* rsym = pReloc.symInfo();
565 m_PostponedRelocs[rsym].insert(&pReloc);
583 bool MipsRelocator::isGpDisp(const Relocation& pReloc) const
585 return 0 == strcmp("_gp_disp", pReloc.symInfo()->name());
613 Fragment& MipsRelocator::getLocalGOTEntry(MipsRelocationInfo& pReloc,
617 ResolveInfo* rsym = pReloc.parent().symInfo();
642 Fragment& MipsRelocator::getGlobalGOTEntry(MipsRelocationInfo& pReloc)
645 ResolveInfo* rsym = pReloc.parent().symInfo();
663 got.setEntryValue(got_entry, pReloc.parent().symValue());
670 Relocator::Address MipsRelocator::getGOTOffset(MipsRelocationInfo& pReloc)
672 ResolveInfo* rsym = pReloc.parent().symInfo();
676 uint64_t value = pReloc.S();
679 value += pReloc.A();
682 getLocalGOTEntry(pReloc, value));
685 return got.getGPRelOffset(getApplyingInput(), getGlobalGOTEntry(pReloc));
689 void MipsRelocator::createDynRel(MipsRelocationInfo& pReloc)
691 Relocator::DWord A = pReloc.A();
692 Relocator::DWord S = pReloc.S();
694 ResolveInfo* rsym = pReloc.parent().symInfo();
697 setupRelDynEntry(pReloc.parent().targetRef(), NULL);
698 pReloc.result() = A + S;
701 setupRelDynEntry(pReloc.parent().targetRef(), rsym);
703 pReloc.result() = A;
795 MipsRelocator::Result none(MipsRelocationInfo& pReloc, MipsRelocator& pParent)
802 MipsRelocator::Result abs32(MipsRelocationInfo& pReloc, MipsRelocator& pParent)
804 ResolveInfo* rsym = pReloc.parent().symInfo();
806 Relocator::DWord A = pReloc.A();
807 Relocator::DWord S = pReloc.S();
810 pReloc.parent().targetRef().frag()->getParent()->getSection();
815 pReloc.result() = S + A;
820 pParent.createDynRel(pReloc);
824 pReloc.result() = S + A;
833 MipsRelocator::Result rel26(MipsRelocationInfo& pReloc, MipsRelocator& pParent)
835 ResolveInfo* rsym = pReloc.parent().symInfo();
837 int32_t A = ((pReloc.parent().target() & 0x03FFFFFF) << 2);
838 int32_t P = pReloc.P();
841 : pReloc.S();
844 pReloc.result() = A | ((P + 4) & 0x3F000000);
846 pReloc.result() = mcld::signExtend<28>(A);
848 pReloc.result() = (pReloc.result() + S) >> 2;
857 MipsRelocator::Result hi16(MipsRelocationInfo& pReloc, MipsRelocator& pParent)
859 uint64_t AHL = pParent.calcAHL(pReloc);
861 if (pParent.isGpDisp(pReloc.parent())) {
862 int32_t P = pReloc.P();
864 pReloc.result() = ((AHL + GP - P) - (int16_t)(AHL + GP - P)) >> 16;
867 int32_t S = pReloc.S();
869 pReloc.result() = (pReloc.A() + S + 0x8000ull) >> 16;
871 pReloc.result() = ((AHL + S) - (int16_t)(AHL + S)) >> 16;
881 MipsRelocator::Result lo16(MipsRelocationInfo& pReloc, MipsRelocator& pParent)
886 int32_t AHL = (pReloc.A() & 0xFFFF);
888 if (pParent.isGpDisp(pReloc.parent())) {
889 int32_t P = pReloc.P();
891 pReloc.result() = AHL + GP - P + 4;
894 int32_t S = pReloc.S();
895 pReloc.result() = AHL + S;
898 pParent.applyPostponedRelocations(pReloc);
907 MipsRelocator::Result gprel16(MipsRelocationInfo& pReloc, MipsRelocator& pParent)
910 uint64_t A = pReloc.A();
911 uint64_t S = pReloc.S();
915 ResolveInfo* rsym = pReloc.parent().symInfo();
917 pReloc.result() = A + S + GP0 - GP;
919 pReloc.result() = A + S - GP;
928 MipsRelocator::Result got16(MipsRelocationInfo& pReloc, MipsRelocator& pParent)
930 if (pReloc.parent().symInfo()->isLocal()) {
931 int32_t AHL = pParent.calcAHL(pReloc);
932 int32_t S = pReloc.S();
937 Fragment& got_entry = pParent.getLocalGOTEntry(pReloc, res);
939 pReloc.result() = got.getGPRelOffset(pParent.getApplyingInput(), got_entry);
942 pReloc.result() = pParent.getGOTOffset(pReloc);
951 MipsRelocator::Result gothi16(MipsRelocationInfo& pReloc, MipsRelocator& pParent)
953 Relocator::Address G = pParent.getGOTOffset(pReloc);
954 int32_t A = pReloc.A();
956 pReloc.result() = (G - (int16_t)G) >> (16 + A);
964 MipsRelocator::Result gotlo16(MipsRelocationInfo& pReloc, MipsRelocator& pParent)
966 pReloc.result() = pParent.getGOTOffset(pReloc) & 0xffff;
974 MipsRelocator::Result sub(MipsRelocationInfo& pReloc, MipsRelocator& pParent)
976 uint64_t S = pReloc.S();
977 uint64_t A = pReloc.A();
979 pReloc.result() = S - A;
986 MipsRelocator::Result call16(MipsRelocationInfo& pReloc, MipsRelocator& pParent)
988 pReloc.result() = pParent.getGOTOffset(pReloc);
995 MipsRelocator::Result gprel32(MipsRelocationInfo& pReloc, MipsRelocator& pParent)
998 uint64_t A = pReloc.A();
999 uint64_t S = pReloc.S();
1003 pReloc.result() = A + S + GP0 - GP;
1010 MipsRelocator::Result abs64(MipsRelocationInfo& pReloc, MipsRelocator& pParent)
1014 ResolveInfo* rsym = pReloc.parent().symInfo();
1016 Relocator::DWord A = pReloc.A();
1017 Relocator::DWord S = pReloc.S();
1020 pReloc.parent().targetRef().frag()->getParent()->getSection();
1025 pReloc.result() = S + A;
1030 pParent.createDynRel(pReloc);
1034 pReloc.result() = S + A;
1041 MipsRelocator::Result gotdisp(MipsRelocationInfo& pReloc, MipsRelocator& pParent)
1043 pReloc.result() = pParent.getGOTOffset(pReloc);
1050 MipsRelocator::Result gotoff(MipsRelocationInfo& pReloc, MipsRelocator& pParent)
1058 MipsRelocator::Result jalr(MipsRelocationInfo& pReloc, MipsRelocator& pParent)
1065 MipsRelocator::Result la25lui(MipsRelocationInfo& pReloc, MipsRelocator& pParent)
1067 int32_t S = pReloc.S();
1069 pReloc.result() = (S + 0x8000) >> 16;
1076 MipsRelocator::Result la25j(MipsRelocationInfo& pReloc, MipsRelocator& pParent)
1078 int32_t S = pReloc.S();
1080 pReloc.result() = S >> 2;
1087 MipsRelocator::Result la25add(MipsRelocationInfo& pReloc, MipsRelocator& pParent)
1089 pReloc.result() = pReloc.S();
1096 MipsRelocator::Result pc32(MipsRelocationInfo& pReloc, MipsRelocator& pParent)
1102 MipsRelocator::Result unsupport(MipsRelocationInfo& pReloc, MipsRelocator& pParent)