@@ -513,11 +513,11 @@ static void initSymbolAnchors() {
513
513
continue ;
514
514
for (InputSection *sec : getInputSections (*osec, storage)) {
515
515
sec->relaxAux = make<RISCVRelaxAux>();
516
- if (sec->relocations .size ()) {
516
+ if (sec->relocs () .size ()) {
517
517
sec->relaxAux ->relocDeltas =
518
- std::make_unique<uint32_t []>(sec->relocations .size ());
518
+ std::make_unique<uint32_t []>(sec->relocs () .size ());
519
519
sec->relaxAux ->relocTypes =
520
- std::make_unique<RelType[]>(sec->relocations .size ());
520
+ std::make_unique<RelType[]>(sec->relocs () .size ());
521
521
}
522
522
}
523
523
}
@@ -617,7 +617,7 @@ static bool relax(InputSection &sec) {
617
617
DenseMap<const Defined *, uint64_t > valueDelta;
618
618
ArrayRef<SymbolAnchor> sa = makeArrayRef (aux.anchors );
619
619
uint32_t delta = 0 ;
620
- for (auto [i, r] : llvm::enumerate (sec.relocations )) {
620
+ for (auto [i, r] : llvm::enumerate (sec.relocs () )) {
621
621
for (; sa.size () && sa[0 ].offset <= r.offset ; sa = sa.slice (1 ))
622
622
if (!sa[0 ].end )
623
623
valueDelta[sa[0 ].d ] = delta;
@@ -629,9 +629,9 @@ static bool relax(InputSection &sec) {
629
629
sa = makeArrayRef (aux.anchors );
630
630
delta = 0 ;
631
631
632
- std::fill_n (aux.relocTypes .get (), sec.relocations .size (), R_RISCV_NONE);
632
+ std::fill_n (aux.relocTypes .get (), sec.relocs () .size (), R_RISCV_NONE);
633
633
aux.writes .clear ();
634
- for (auto [i, r] : llvm::enumerate (sec.relocations )) {
634
+ for (auto [i, r] : llvm::enumerate (sec.relocs () )) {
635
635
const uint64_t loc = secAddr + r.offset - delta;
636
636
uint32_t &cur = aux.relocDeltas [i], remove = 0 ;
637
637
switch (r.type ) {
@@ -646,16 +646,16 @@ static bool relax(InputSection &sec) {
646
646
}
647
647
case R_RISCV_CALL:
648
648
case R_RISCV_CALL_PLT:
649
- if (i + 1 != sec.relocations .size () &&
650
- sec.relocations [i + 1 ].type == R_RISCV_RELAX)
649
+ if (i + 1 != sec.relocs () .size () &&
650
+ sec.relocs () [i + 1 ].type == R_RISCV_RELAX)
651
651
relaxCall (sec, i, loc, r, remove);
652
652
break ;
653
653
case R_RISCV_TPREL_HI20:
654
654
case R_RISCV_TPREL_ADD:
655
655
case R_RISCV_TPREL_LO12_I:
656
656
case R_RISCV_TPREL_LO12_S:
657
- if (i + 1 != sec.relocations .size () &&
658
- sec.relocations [i + 1 ].type == R_RISCV_RELAX)
657
+ if (i + 1 != sec.relocs () .size () &&
658
+ sec.relocs () [i + 1 ].type == R_RISCV_RELAX)
659
659
relaxTlsLe (sec, i, loc, r, remove);
660
660
break ;
661
661
}
@@ -727,10 +727,9 @@ void elf::riscvFinalizeRelax(int passes) {
727
727
if (!aux.relocDeltas )
728
728
continue ;
729
729
730
- auto & rels = sec->relocations ;
730
+ MutableArrayRef<Relocation> rels = sec->relocs () ;
731
731
ArrayRef<uint8_t > old = sec->content ();
732
- size_t newSize =
733
- old.size () - aux.relocDeltas [sec->relocations .size () - 1 ];
732
+ size_t newSize = old.size () - aux.relocDeltas [rels.size () - 1 ];
734
733
size_t writesIdx = 0 ;
735
734
uint8_t *p = context ().bAlloc .Allocate <uint8_t >(newSize);
736
735
uint64_t offset = 0 ;
0 commit comments