[llvm] [lldb][LoongArch] Fix expression function call failure (PR #136563)

Lu Weining via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 21 18:56:58 PDT 2025


================
@@ -662,7 +662,16 @@ bool RuntimeDyldELF::resolveLoongArch64ShortBranch(
   }
   uint64_t Offset = RelI->getOffset();
   uint64_t SourceAddress = Sections[SectionID].getLoadAddressWithOffset(Offset);
-  if (!isInt<28>(Address + Value.Addend - SourceAddress))
+  // Normal call
+  if (RelI->getType() == ELF::R_LARCH_B26) {
+    if (!isInt<28>(Address + Value.Addend - SourceAddress))
+      return false;
+    resolveRelocation(Sections[SectionID], Offset, Address, RelI->getType(),
+                      Value.Addend);
+    return true;
+  }
+  // Medium call: R_LARCH_CALL36
+  if (!isInt<38>(Address + Value.Addend - SourceAddress))
----------------
SixWeining wrote:

The exact range should be `[PC-128GiB-0x20000, PC+128GiB-0x20000-4]`.

https://github.com/llvm/llvm-project/pull/136563


More information about the llvm-commits mailing list