Skip to content

Commit c18b57d

Browse files
committed
Add check for register.
1 parent 5e854ab commit c18b57d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lld/ELF/Arch/LoongArch.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,10 @@ bool LoongArch::tryGotToPCRel(uint8_t *loc, const Relocation &rHi20,
11901190

11911191
const uint32_t currInsn = read32le(loc);
11921192
const uint32_t nextInsn = read32le(loc + 4);
1193+
// Check if use the same register.
1194+
if (getD5(currInsn) != getJ5(nextInsn) || getJ5(nextInsn) != getD5(nextInsn))
1195+
return false;
1196+
11931197
uint64_t pageDelta =
11941198
getLoongArchPageDelta(symLocal, secAddr + rHi20.offset, rHi20.type);
11951199
// pcalau12i $a0, %pc_hi20

0 commit comments

Comments
 (0)