Skip to content

Commit aeb7ab9

Browse files
committed
[𝘀𝗽𝗿] initial version
Created using spr 1.3.5-bogner
1 parent 940108b commit aeb7ab9

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,16 @@ bool RuntimeDyldELF::resolveLoongArch64ShortBranch(
662662
}
663663
uint64_t Offset = RelI->getOffset();
664664
uint64_t SourceAddress = Sections[SectionID].getLoadAddressWithOffset(Offset);
665-
if (!isInt<28>(Address + Value.Addend - SourceAddress))
665+
// Normal call
666+
if (RelI->getType() == ELF::R_LARCH_B26) {
667+
if (!isInt<28>(Address + Value.Addend - SourceAddress))
668+
return false;
669+
resolveRelocation(Sections[SectionID], Offset, Address, RelI->getType(),
670+
Value.Addend);
671+
return true;
672+
}
673+
// Medium call: R_LARCH_CALL36
674+
if (!isInt<38>(Address + Value.Addend - SourceAddress))
666675
return false;
667676
resolveRelocation(Sections[SectionID], Offset, Address, RelI->getType(),
668677
Value.Addend);
@@ -1743,7 +1752,8 @@ RuntimeDyldELF::processRelocationRef(
17431752
processSimpleRelocation(SectionID, Offset, RelType, Value);
17441753
}
17451754
} else if (Arch == Triple::loongarch64) {
1746-
if (RelType == ELF::R_LARCH_B26 && MemMgr.allowStubAllocation()) {
1755+
if ((RelType == ELF::R_LARCH_B26 || RelType == ELF::R_LARCH_CALL36) &&
1756+
MemMgr.allowStubAllocation()) {
17471757
resolveLoongArch64Branch(SectionID, Value, RelI, Stubs);
17481758
} else if (RelType == ELF::R_LARCH_GOT_PC_HI20 ||
17491759
RelType == ELF::R_LARCH_GOT_PC_LO12) {

0 commit comments

Comments
 (0)