Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement unwinding for ARM #5265

Closed
sanxiyn opened this issue Mar 7, 2013 · 7 comments
Closed

Implement unwinding for ARM #5265

sanxiyn opened this issue Mar 7, 2013 · 7 comments
Labels
A-codegen Area: Code generation O-android Operating system: Android
Milestone

Comments

@sanxiyn
Copy link
Member

sanxiyn commented Mar 7, 2013

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

@brson
Copy link
Contributor

brson commented Mar 8, 2013

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

@ILyoan
Copy link
Contributor

ILyoan commented Mar 8, 2013

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

@ILyoan
Copy link
Contributor

ILyoan commented Mar 8, 2013

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?

@brson
Copy link
Contributor

brson commented Mar 8, 2013

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

@ILyoan
Copy link
Contributor

ILyoan commented Mar 11, 2013

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.

@graydon
Copy link
Contributor

graydon commented Mar 11, 2013

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

@ILyoan
Copy link
Contributor

ILyoan commented Mar 16, 2013

There are two options to enable unwinding for ARM

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

bors added a commit that referenced this issue Mar 20, 2013
Partial Fix for #5265

- Enabling LLVM ARM ehabi option.
- Add ARM debug information manually for ccall.s
- Compile object file using Android-NDK.

Current LLVM trunk version can generate ARM debug information for assembly files but it is incomplete for object files. Unwinding on ARM can be done with LLVM trunk(the LLVM submodule of rust has problem on generating ARM debug information). See #5368

The Android-NDK detour(0f89eab) can be removed after LLVM has complete feature of generating ARM debug information for object file.
@sanxiyn sanxiyn closed this as completed Apr 16, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation O-android Operating system: Android
Projects
None yet
Development

No branches or pull requests

4 participants