This is an archive of the discontinued LLVM Phabricator instance.

[libunwind] Don't assume the return address register is always saved and has CFI for it
AbandonedPublic

Authored by thegameg on Jun 22 2017, 5:16 PM.

Details

Summary

If we want to take shrink-wrapping to the next level, we will shrink-wrap the return address register, and realize that on some paths we don't actually need to save it.

In this case, libunwind fails to set IP to the return address, since there are no CFI directives on how to get its value in that IP range.

The following fix gets the return address from the current return address register, and if there are CFI directives for it, it will be overriden.

Not sure how libunwind is tested (it has only 4 tests in the test directory). Probably the test case can be reduced or dropped since it comes from the llvm test-suite.

Diff Detail

Event Timeline

thegameg created this revision.Jun 22 2017, 5:16 PM
hfinkel added inline comments.
src/DwarfInstructions.hpp
168–172

Please start sentences in comments with a capital letter.

thegameg updated this revision to Diff 103677.Jun 22 2017, 5:47 PM
thegameg marked an inline comment as done.
thegameg abandoned this revision.Sep 17 2020, 3:18 PM

Won't be back to this anytime soon.