Index: ELF/InputSection.cpp =================================================================== --- ELF/InputSection.cpp +++ ELF/InputSection.cpp @@ -923,7 +923,10 @@ continue; if (Defined *F = getEnclosingFunction(Rel.Offset)) { - if (Target->adjustPrologueForCrossSplitStack(Buf + F->Value, End)) { + uint64_t SecOffset = 0; + if (auto *Sec = dyn_cast(this)) + SecOffset = Sec->OutSecOff; + if (Target->adjustPrologueForCrossSplitStack(Buf + SecOffset + F->Value, End)) { AdjustedPrologues.insert(F); continue; } Index: ELF/Target.cpp =================================================================== --- ELF/Target.cpp +++ ELF/Target.cpp @@ -91,13 +91,13 @@ template static ErrorPlace getErrPlace(const uint8_t *Loc) { for (InputSectionBase *D : InputSections) { - auto *IS = cast(D); - if (!IS->getParent()) - continue; - - uint8_t *ISLoc = IS->getParent()->Loc + IS->OutSecOff; - if (ISLoc <= Loc && Loc < ISLoc + IS->getSize()) - return {IS, IS->template getLocation(Loc - ISLoc) + ": "}; + InputSection *IS = dyn_cast(D); + + if (IS && IS->getParent()) { + uint8_t *ISLoc = IS->getParent()->Loc + IS->OutSecOff; + if (ISLoc <= Loc && Loc < ISLoc + IS->getSize()) + return {IS, IS->template getLocation(Loc - ISLoc) + ": "}; + } } return {}; }