This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add CFI directives for RISCV epilog
AbandonedPublic

Authored by Miss_Grape on Feb 8 2022, 10:41 PM.

Diff Detail

Event Timeline

Miss_Grape created this revision.Feb 8 2022, 10:41 PM
Miss_Grape requested review of this revision.Feb 8 2022, 10:41 PM

Do you mind add a test case to demonstrate that we've emit .cfi_def_cfa after this patch?

Miss_Grape added a comment.EditedFeb 9 2022, 12:59 AM

Do you mind add a test case to demonstrate that we've emit .cfi_def_cfa after this patch?

The CFI directives is emitted to ensure that it can correctly print the stack debug in the case of debugging. We need to update the CFA in the function Epilogue, otherwise we cannot find the calling relationship of the caller function
The following shows the difference between the debug_frame sections of clang and riscv-unknown-elf-gcc


jrtc27 requested changes to this revision.Feb 9 2022, 5:40 AM

This lack of CFI is deliberate. See https://reviews.llvm.org/D69723 and discussions in https://reviews.llvm.org/D111519. The underlying problem has not been fixed, so we cannot do this.

This revision now requires changes to proceed.Feb 9 2022, 5:40 AM

Perhaps something we can do to avoid this in the future is add a comment to emitEpilogue explaining why we deliberately don't emit CFI directives, pointing to these discussions and a bug number (creating one if no such bug exists)?