This is an archive of the discontinued LLVM Phabricator instance.

[BOLT] Add reading support for Linux ORC sections
ClosedPublic

Authored by maksfb on Jul 9 2023, 10:24 PM.

Details

Summary

Read ORC (oops rewind capability) info used for unwinding the stack by
Linux Kernel. The info is stored in .orc_unwind and .orc_unwind_ip
sections. There is also a related .orc_lookup section that is being
populated by the kernel during runtime. Contents of the sections are
sorted for quicker lookup by a post-link objtool.

Unless we modify stack access instructions, we don't have to change ORC
info attributed to instructions in the binary. However, we need to
update instruction addresses and sort both sections based on the new
layout.

For pretty printing, we add "--print-orc" option that prints ORC info
next to instructions in code dumps.

Diff Detail

Event Timeline

maksfb created this revision.Jul 9 2023, 10:24 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 9 2023, 10:24 PM
maksfb requested review of this revision.Jul 9 2023, 10:24 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 9 2023, 10:24 PM
maksfb updated this revision to Diff 539845.Jul 12 2023, 10:23 PM

Rename ORCEntry to ORCState. Move BinaryFunction out of the struct.

Amir added inline comments.Jul 13 2023, 10:39 AM
bolt/lib/Rewrite/LinuxKernelRewriter.cpp
440–442

Shall we define named constants for clarity?

This revision is now accepted and ready to land.Jul 13 2023, 10:39 AM
maksfb updated this revision to Diff 540122.Jul 13 2023, 11:05 AM

Add named constants.

maksfb marked an inline comment as done.Jul 13 2023, 11:05 AM
This revision was landed with ongoing or failed builds.Jul 13 2023, 11:07 AM
This revision was automatically updated to reflect the committed changes.