This is an archive of the discontinued LLVM Phabricator instance.

Emit unwind information in .debug_frame section when .cfi_sections .debug_frame intrinsic is used
ClosedPublic

Authored by rastogishubham on Apr 10 2023, 5:13 PM.

Details

Summary

The

.cfi_sections .debug_frame

intrinsic is used to emit .debug_frame section. This directive tells the assembler to write out a section of debug frame data. ARM64 however, is a platform where eh_frame is not needed for unwind information. Unfortunately, that means that even when the

.cfi_sections .debug_frame

intrinsic is used, the compiler skips emitting the CIE's and FDE's in the debug_frame section. This patch address that issue by making sure that the emission of CIE's and FDE's are only skipped if the unwind information does not require a debug_frame section and is a platform where the eh_frame can be skipped

Diff Detail

Event Timeline

rastogishubham created this revision.Apr 10 2023, 5:13 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 10 2023, 5:13 PM
rastogishubham requested review of this revision.Apr 10 2023, 5:13 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 10 2023, 5:13 PM

Add some comments

aprantl added inline comments.Apr 12 2023, 7:14 PM
llvm/lib/MC/MCDwarf.cpp
1910

I still find this sentence confusing.

Does this convey what you want to say?

Don't generate eh_frame if it's not needed. It's not needed if either eh_frame isn't requested or if we can use compact unwind instead.

I addressed the review feedback about clarifying the comment I had written for when to skip emitting the FDEs and CIEs

aprantl added inline comments.Apr 14 2023, 10:50 AM
llvm/test/DebugInfo/AArch64/debugframeinfo.s
7

You only want top test that some debug_frame contents is emitted, right?
Assuming that there is another test that already tests whether we are emitting .debug_frame correctly, it should be sufficient to test for a nonempty .debug_frame section here.
All the hardcoded offsets and numbers here are not relevant to you patch and I'm slightly worried that they would change frequently with other unrelated compiler changes?

Addressed review feedback about test just checking for if debug_frame section is non-empty

rastogishubham marked 2 inline comments as done.Apr 18 2023, 12:52 PM
aprantl accepted this revision.Apr 26 2023, 2:41 PM

Let's give this a try.

This revision is now accepted and ready to land.Apr 26 2023, 2:41 PM
This revision was landed with ongoing or failed builds.Apr 26 2023, 4:20 PM
This revision was automatically updated to reflect the committed changes.