This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Print file name and section offset in .eh_frame parser
ClosedPublic

Authored by evgeny777 on Nov 21 2016, 7:48 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

evgeny777 updated this revision to Diff 78719.Nov 21 2016, 7:48 AM
evgeny777 retitled this revision from to [ELF] Print file name and section offset in .eh_frame parser.
evgeny777 updated this object.
evgeny777 added reviewers: ruiu, rafael.
evgeny777 set the repository for this revision to rL LLVM.
evgeny777 added a project: lld.
evgeny777 added subscribers: ikudrin, grimar, llvm-commits.
ruiu added inline comments.Nov 21 2016, 8:01 AM
ELF/EhFrame.cpp
42 ↗(On Diff #78719)

Do you need ::?

Ah, so you are defining a new function with the same name. Please avoid overloading because the two functions are semantically different.

143 ↗(On Diff #78719)

I'd add this function to ReadHelper to eliminate H. from this function. And then probably you want to rename ReadHelper EhReader or something like that.

You can also eliminate ArrayRef<uint_8> & from read* functions if you make the ArrayRef a member of the class.

ELF/EhFrame.h
13 ↗(On Diff #78719)

Instead of adding a new #include, declare the class you need.

evgeny777 added inline comments.Nov 21 2016, 8:12 AM
ELF/EhFrame.cpp
143 ↗(On Diff #78719)

This function is called from outside (OutputSections.cpp), so the caller should construct EhReader then. Is this good?

ruiu added inline comments.Nov 21 2016, 8:16 AM
ELF/EhFrame.cpp
143 ↗(On Diff #78719)

You can keep the existing function interface, right?

template <class ELFT> uint8_t elf::getFdeEncoding(EhSectionPiece *Piece) {
  auto *Sec = cast<InputSectionBase<ELFT> *>(Piece->ID);
  return EhReader(Sec, Piece->data()).getFdeEncoding();
}
evgeny777 added inline comments.Nov 21 2016, 8:17 AM
ELF/EhFrame.cpp
143 ↗(On Diff #78719)

Oh, I see. Now clear.

evgeny777 updated this revision to Diff 78852.Nov 22 2016, 5:22 AM
evgeny777 removed rL LLVM as the repository for this revision.

Addressed review comments

ruiu accepted this revision.Nov 22 2016, 8:31 AM
ruiu edited edge metadata.

LGTM. This is beautiful!

This revision is now accepted and ready to land.Nov 22 2016, 8:31 AM
This revision was automatically updated to reflect the committed changes.