rust icon indicating copy to clipboard operation
rust copied to clipboard

Implement unwinding for ARM

Open sanxiyn opened this issue 13 years ago • 7 comments

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).

sanxiyn avatar Mar 07 '13 15:03 sanxiyn

Graydon has been implementing a new, platform-agnostic unwinding strategy that we could use on ARM, at least in the short term.

brson avatar Mar 08 '13 01:03 brson

Yeah I was trying to use that patch yesterday but there were too many conflicts :(

ILyoan avatar Mar 08 '13 01:03 ILyoan

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?

ILyoan avatar Mar 08 '13 11:03 ILyoan

@graydon What's the state of return-unwind?

brson avatar Mar 08 '13 19:03 brson

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.

ILyoan avatar Mar 11 '13 13:03 ILyoan

I'll refresh the return unwind patch. It's paused pending performance investigation, but I guess can ... plausibly land as an option.

graydon avatar Mar 11 '13 18:03 graydon

There are two options to enable unwinding for ARM

  1. Implement the "Not Implemented" function in ARMELFStreamer.cpp. This involves modification of LLVM. See #5368
  2. 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.

ILyoan avatar Mar 16 '13 09:03 ILyoan