Skip to content

Commit 1d6718b

Browse files
committed
[RISCV][lld] Guarding lld relaxation for RISCV
Based on #123248 (comment), the relaxation algorithm assumes relaxing a call will shift the later function forward by the same bytes we removed. As some sections are between call and its call target are 32-byte aligned, the call and call target sections might not be the same distance apart. We guard band the relaxation so it stops the relaxation loop and take the last state.
1 parent 9543e9e commit 1d6718b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lld/ELF/Arch/RISCV.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,9 @@ bool RISCV::relaxOnce(int pass) const {
902902
if (ctx.arg.relocatable)
903903
return false;
904904

905+
if (pass == 29)
906+
return false;
907+
905908
if (pass == 0)
906909
initSymbolAnchors(ctx);
907910

0 commit comments

Comments
 (0)