diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp --- a/lld/ELF/Arch/RISCV.cpp +++ b/lld/ELF/Arch/RISCV.cpp @@ -662,23 +662,8 @@ const uint64_t secAddr = sec.getVA(); auto &aux = *sec.relaxAux; bool changed = false; - - // Get st_value delta for symbols relative to this section from the previous - // iteration. - DenseMap valueDelta; ArrayRef sa = ArrayRef(aux.anchors); uint32_t delta = 0; - for (auto [i, r] : llvm::enumerate(sec.relocs())) { - for (; sa.size() && sa[0].offset <= r.offset; sa = sa.slice(1)) - if (!sa[0].end) - valueDelta[sa[0].d] = delta; - delta = aux.relocDeltas[i]; - } - for (const SymbolAnchor &sa : sa) - if (!sa.end) - valueDelta[sa.d] = delta; - sa = ArrayRef(aux.anchors); - delta = 0; std::fill_n(aux.relocTypes.get(), sec.relocs().size(), R_RISCV_NONE); aux.writes.clear(); @@ -725,7 +710,7 @@ if (sa[0].end) sa[0].d->size = sa[0].offset - delta - sa[0].d->value; else - sa[0].d->value -= delta - valueDelta.find(sa[0].d)->second; + sa[0].d->value = sa[0].offset - delta; } delta += remove; if (delta != cur) { @@ -738,7 +723,7 @@ if (a.end) a.d->size = a.offset - delta - a.d->value; else - a.d->value -= delta - valueDelta.find(a.d)->second; + a.d->value = a.offset - delta; } // Inform assignAddresses that the size has changed. if (!isUInt<16>(delta))