Skip to content

Commit 30a9eb5

Browse files
committed
Add check for register.
1 parent 6e05f36 commit 30a9eb5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Diff for: lld/ELF/Arch/LoongArch.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -1188,6 +1188,10 @@ bool LoongArch::tryGotToPCRel(uint8_t *loc, const Relocation &rHi20,
11881188

11891189
const uint32_t currInsn = read32le(loc);
11901190
const uint32_t nextInsn = read32le(loc + 4);
1191+
// Check if use the same register.
1192+
if (getD5(currInsn) != getJ5(nextInsn) || getJ5(nextInsn) != getD5(nextInsn))
1193+
return false;
1194+
11911195
uint64_t pageDelta =
11921196
getLoongArchPageDelta(symLocal, secAddr + rHi20.offset, rHi20.type);
11931197
// pcalau12i $a0, %pc_hi20

0 commit comments

Comments
 (0)