Skip to content

Commit 95e7d56

Browse files
committed
[CHERIoT] Restore upstream use of relocateNoSym for call reloc resolution.
This is possible now that isPCCRelative is no longer called in relocate().
1 parent e870c75 commit 95e7d56

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

lld/ELF/Arch/RISCV.cpp

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -501,20 +501,16 @@ void RISCV::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const {
501501
int64_t hi = SignExtend64(val + 0x800, bits) >> 12;
502502
checkInt(ctx, loc, hi, 20, rel);
503503
if (isInt<20>(hi)) {
504-
relocate(loc,
505-
Relocation{R_NONE,
506-
ctx.arg.isCheriot
507-
? INTERNAL_R_RISCV_CHERIOT_COMPARTMENT_PCCREL_HI
508-
: R_RISCV_PCREL_HI20,
509-
0, 0, rel.sym},
510-
val);
511-
relocate(loc + 4,
512-
Relocation{R_NONE,
513-
ctx.arg.isCheriot
514-
? INTERNAL_R_RISCV_CHERIOT_COMPARTMENT_PCCREL_LO_I
515-
: R_RISCV_PCREL_LO12_I,
516-
0, 0, rel.sym},
517-
val);
504+
relocateNoSym(loc,
505+
ctx.arg.isCheriot
506+
? INTERNAL_R_RISCV_CHERIOT_COMPARTMENT_PCCREL_HI
507+
: R_RISCV_PCREL_HI20,
508+
val);
509+
relocateNoSym(loc + 4,
510+
ctx.arg.isCheriot
511+
? INTERNAL_R_RISCV_CHERIOT_COMPARTMENT_PCCREL_LO_I
512+
: R_RISCV_PCREL_LO12_I,
513+
val);
518514
}
519515
return;
520516
}

0 commit comments

Comments
 (0)