diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index 306872f164f6f3..7857d857488c07 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -1073,11 +1073,7 @@ void InputSectionBase::relocate(uint8_t *buf, uint8_t *bufEnd) { auto *sec = cast(this); // For a relocatable link, also call relocateNonAlloc() to rewrite applicable // locations with tombstone values. - const RelsOrRelas rels = sec->template relsOrRelas(); - if (rels.areRelocsRel()) - sec->relocateNonAlloc(buf, rels.rels); - else - sec->relocateNonAlloc(buf, rels.relas); + invokeOnRelocs(*sec, sec->relocateNonAlloc, buf); } // For each function-defining prologue, find any calls to __morestack,