@@ -214,9 +214,9 @@ void RISCV::writeGotPlt(uint8_t *buf, const Symbol &s) const {
214214void RISCV::writeIgotPlt (uint8_t *buf, const Symbol &s) const {
215215 if (ctx.arg .writeAddends ) {
216216 if (ctx.arg .is64 )
217- write64le (buf, s.getVA ());
217+ write64le (buf, s.getVA (ctx ));
218218 else
219- write32le (buf, s.getVA ());
219+ write32le (buf, s.getVA (ctx ));
220220 }
221221}
222222
@@ -466,7 +466,7 @@ void RISCV::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const {
466466 case INTERNAL_R_RISCV_GPREL_I:
467467 case INTERNAL_R_RISCV_GPREL_S: {
468468 Defined *gp = ctx.sym .riscvGlobalPointer ;
469- int64_t displace = SignExtend64 (val - gp->getVA (), bits);
469+ int64_t displace = SignExtend64 (val - gp->getVA (ctx ), bits);
470470 checkInt (ctx, loc, displace, 12 , rel);
471471 uint32_t insn = (read32le (loc) & ~(31 << 15 )) | (X_GP << 15 );
472472 if (rel.type == INTERNAL_R_RISCV_GPREL_I)
@@ -657,7 +657,8 @@ void RISCV::relocateAlloc(InputSectionBase &sec, uint8_t *buf) const {
657657 const Relocation &rel1 = relocs[i + 1 ];
658658 if (rel.type == R_RISCV_SET_ULEB128 &&
659659 rel1.type == R_RISCV_SUB_ULEB128 && rel.offset == rel1.offset ) {
660- auto val = rel.sym ->getVA (rel.addend ) - rel1.sym ->getVA (rel1.addend );
660+ auto val = rel.sym ->getVA (ctx, rel.addend ) -
661+ rel1.sym ->getVA (ctx, rel1.addend );
661662 if (overwriteULEB128 (loc, val) >= 0x80 )
662663 errorOrWarn (sec.getLocation (rel.offset ) + " : ULEB128 value " +
663664 Twine (val) + " exceeds available space; references '" +
@@ -737,7 +738,7 @@ static void relaxCall(Ctx &ctx, const InputSection &sec, size_t i, uint64_t loc,
737738 const uint64_t insnPair = read64le (sec.content ().data () + r.offset );
738739 const uint32_t rd = extractBits (insnPair, 32 + 11 , 32 + 7 );
739740 const uint64_t dest =
740- (r.expr == R_PLT_PC ? sym.getPltVA (ctx) : sym.getVA ()) + r.addend ;
741+ (r.expr == R_PLT_PC ? sym.getPltVA (ctx) : sym.getVA (ctx )) + r.addend ;
741742 const int64_t displace = dest - loc;
742743
743744 if (rvc && isInt<12 >(displace) && rd == 0 ) {
@@ -759,7 +760,7 @@ static void relaxCall(Ctx &ctx, const InputSection &sec, size_t i, uint64_t loc,
759760// Relax local-exec TLS when hi20 is zero.
760761static void relaxTlsLe (const InputSection &sec, size_t i, uint64_t loc,
761762 Relocation &r, uint32_t &remove) {
762- uint64_t val = r.sym ->getVA (r.addend );
763+ uint64_t val = r.sym ->getVA (ctx, r.addend );
763764 if (hi20 (val) != 0 )
764765 return ;
765766 uint32_t insn = read32le (sec.content ().data () + r.offset );
@@ -791,7 +792,7 @@ static void relaxHi20Lo12(Ctx &ctx, const InputSection &sec, size_t i,
791792 if (!gp)
792793 return ;
793794
794- if (!isInt<12 >(r.sym ->getVA (r.addend ) - gp->getVA ()))
795+ if (!isInt<12 >(r.sym ->getVA (ctx, r.addend ) - gp->getVA (ctx )))
795796 return ;
796797
797798 switch (r.type ) {
@@ -863,7 +864,7 @@ static bool relax(Ctx &ctx, InputSection &sec) {
863864 // For TLSDESC=>LE, we can use the short form if hi20 is zero.
864865 tlsdescRelax = relaxable (relocs, i);
865866 toLeShortForm = tlsdescRelax && r.expr == R_RELAX_TLS_GD_TO_LE &&
866- !hi20 (r.sym ->getVA (r.addend ));
867+ !hi20 (r.sym ->getVA (ctx, r.addend ));
867868 [[fallthrough]];
868869 case R_RISCV_TLSDESC_LOAD_LO12:
869870 // For TLSDESC=>LE/IE, AUIPC and L[DW] are removed if relaxable.
0 commit comments