This is an archive of the discontinued LLVM Phabricator instance.

[LLD][NFC] Remove getOffsetInFile() workaround.
ClosedPublic

Authored by avl on Mar 4 2020, 12:44 PM.

Details

Summary

LLD has workaround for the times when SectionIndex was not passed properly:

LT->getFileLineInfoForAddress(

S->getOffsetInFile() + Offset, nullptr,
DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath, Info));

S->getOffsetInFile() was added to differentiate offsets between
various sections. Now SectionIndex is properly specified.
Thus it is not necessary to use getOffsetInFile() workaround.
See https://reviews.llvm.org/D58194, https://reviews.llvm.org/D58357.

This patch removes getOffsetInFile() workaround.

Diff Detail

Event Timeline

avl created this revision.Mar 4 2020, 12:44 PM
MaskRay accepted this revision.Mar 4 2020, 11:08 PM

Nice clean-up!

This revision is now accepted and ready to land.Mar 4 2020, 11:08 PM
grimar accepted this revision.Mar 5 2020, 12:44 AM

Nice! LGTM with a nit.

lld/ELF/SyntheticSections.cpp
2690–2693

This now seems can be:

// Range list with zero size has no effect.
InputSectionBase *s = sections[r.SectionIndex];
if (s && s != &InputSection::discarded && s->isLive())
  if (r.LowPC != r.HighPC)
    ret.push_back({cast<InputSection>(s), r.LowPC, r.HighPC, cuIdx});
This revision was automatically updated to reflect the committed changes.