Implement unwinding for ARM
LLVM include/llvm/MC/MCAsmInfo.h includes:
enum ExceptionsType { None, DwarfCFI, SjLj, ARM, Win64 };
ARM seems to have its own unwinding format. Here is ARM documentation. LLVM may handle this for us, but it may not. At least, currently, unwinding is broken on ARM.
At the very least, ARM morestack.S needs to have manual unwinding information as it was done for i386 and x86_64.
See also #908 (for Windows) and #4489 (morestack for ARM).
Graydon has been implementing a new, platform-agnostic unwinding strategy that we could use on ARM, at least in the short term.
Yeah I was trying to use that patch yesterday but there were too many conflicts :(
Giving "arm-enable-ehabl" option to llvm may make llvm generate frame information for each function. We are investigating how to give that option.
I also trying to apply return-unwind. This is my branch to apply the "return unwinding".
Trying to build rustc with -Z return-unwind but llvm only gives me error like this
"Assertion `getCondition()->getType()->isIntegerTy(1) && "May only branch on boolean predicates!"' failed."
Since it's about a month back so maybe made mistakes in merging the 'return-unwind' patch.
Any opinion about this?
@graydon What's the state of return-unwind?
Looks like llvm implementation of arm call frame information is incomplete. There is a file called "ARMELFStreamer.cpp" in llvm trunk and it has three "Not implemented" functions that are needed for unwinding.
I'll refresh the return unwind patch. It's paused pending performance investigation, but I guess can ... plausibly land as an option.
There are two options to enable unwinding for ARM
- Implement the "Not Implemented" function in ARMELFStreamer.cpp. This involves modification of LLVM. See #5368
- Just print assembly when target is Android, and then make object file using Android-NDK. This will work because LLVM is able to print stack frame information for assembly. (This approach is a detour that is available until the option 1 is landed) This is my branch implementing the approach.