Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 69ff327

Browse filesBrowse files
committed
Add check for register.
1 parent 1b1804e commit 69ff327
Copy full SHA for 69ff327

File tree

Expand file treeCollapse file tree

1 file changed

+4
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-0
lines changed

‎lld/ELF/Arch/LoongArch.cpp

Copy file name to clipboardExpand all lines: lld/ELF/Arch/LoongArch.cpp
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,11 @@ static void relaxPCHi20Lo12(Ctx &ctx, const InputSection &sec, size_t i,
816816
// addi.w/d.
817817
// * The destination register of pcalau12i is guaranteed to be used only by
818818
// the immediately following instruction.
819+
const uint32_t currInsn = read32le(sec.content().data() + rHi20.offset);
819820
const uint32_t nextInsn = read32le(sec.content().data() + rLo12.offset);
821+
// Check if use the same register.
822+
if (getD5(currInsn) != getJ5(nextInsn) || getJ5(nextInsn) != getD5(nextInsn))
823+
return;
820824

821825
sec.relaxAux->relocTypes[i] = R_LARCH_RELAX;
822826
sec.relaxAux->relocTypes[i + 2] = R_LARCH_PCREL20_S2;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.