Skip to content

unwinding problem on android #11147

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

Closed
yichoi opened this issue Dec 26, 2013 · 13 comments · Fixed by #11301
Closed

unwinding problem on android #11147

yichoi opened this issue Dec 26, 2013 · 13 comments · Fixed by #11301
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows A-testsuite Area: The testsuite used to check the correctness of rustc O-android Operating system: Android

Comments

@yichoi
Copy link
Contributor

yichoi commented Dec 26, 2013

last make check-stage2-T-arm-linux-androideabi-H-x86_64-unknown-linux-gnu on f74b8f0d

failures:
    [run-pass] run-pass/cleanup-copy-mode.rs
    [run-pass] run-pass/fail-in-dtor-drops-fields.rs
    [run-pass] run-pass/tempfile.rs
    [run-pass] run-pass/terminate-in-initializer.rs
    [run-pass] run-pass/unit-like-struct-drop-run.rs
    [run-pass] run-pass/unwind-box.rs
    [run-pass] run-pass/unwind-resource.rs
    [run-pass] run-pass/unwind-resource2.rs
    [run-pass] run-pass/unwind-unique.rs
    [run-pass] run-pass/vector-sort-failure-safe.rs

has same result

fatal runtime error: Could not unwind stack, error = 9
Segmentation fault
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------
task '<unnamed>' failed at 'explicit failure', /home/yichoi/rust_latest/src/test/run-pass/vector-sort-failure-safe.rs:69
@alexcrichton
Copy link
Member

Hm, I find it odd that error 9 is getting returned, because I find any coorespondance to an error higher than 8... If you take a look for definitions of _Unwind_Reason_Code on android, does anything come up for the error 9?

@vadimcn
Copy link
Contributor

vadimcn commented Dec 27, 2013

In ARM EABI there's also _URC_FAILURE = 9 /* unspecified failure of some kind */

Hmm, also, looks like on ARM, _Unwind_Exception needs more room for private unwinder data. The total size of the struct should be 88 bytes on ARM.

At the moment I am not set up to test on Android (can this even be done without a real device?),
@yichoi, would you mind trying the following: in libstd/rt/unwind.rs, replace _Unwind_Exception's private_1 and private_2 fields with private : [_Unwind_Word, ..19] (or maybe 20), and see if that changes anything? Thanks!

@luqmana
Copy link
Member

luqmana commented Dec 27, 2013

@vadimcn using the android emulator might be an option you can try.

@brson
Copy link
Contributor

brson commented Dec 30, 2013

Changing private to [_Unwind_Word, ..20] appears to result in the tests failing to terminate. Odd...

@brson
Copy link
Contributor

brson commented Dec 31, 2013

I'm trying to see if it otherwise works just using C++ throw but keeping all our other new machinery. Maybe __cxa_throw is doing something special on android.

@vadimcn
Copy link
Contributor

vadimcn commented Dec 31, 2013

trying to build android cross-compiler on windows, but no luck so far...

@brson
Copy link
Contributor

brson commented Dec 31, 2013

I think the problem I was seeing is not that the tests are failing to terminate, but adb_run_wrapper.sh not coping with the following error, which itself is very peculiar:

CANNOT LINK EXECUTABLE: cannot locate symbol "_ZN2rt4util12dumb_println67h81a04d63b9f37141ed6a4d8d646e2997716a3d70842c8e2878dd5342a124ed28aV8v0.9.preE" referenced by "./unwind-box.stage1-arm-linux-androideabi"...

@brson
Copy link
Contributor

brson commented Dec 31, 2013

Hm, I just did a successful test run on Android. I think something was causing my libstd on the emu to be stale.

@brson
Copy link
Contributor

brson commented Dec 31, 2013

This branch makes unwinding work on android by using a C++ try function and using the g++ personality fn: https://github.com/brson/rust/tree/androidwip. I don't know why.

@vadimcn
Copy link
Contributor

vadimcn commented Jan 1, 2014

I thought you said you've got it working... Or was that using C++ throw?

@brson
Copy link
Contributor

brson commented Jan 1, 2014

I'm not sure. I'm having a hard time understanding which configurations work. I believe it works when android just uses C++ for everything, plus the g++ personality function. I'll probably try committing a patch that uses C++ for just android until we figure something else out.

@brson
Copy link
Contributor

brson commented Jan 1, 2014

No, I have a patch that just completely uses the C++ unwinder for Android. I'll probably try to clean it up and get it merged and leave fixing the underlying problem for later.

@vadimcn
Copy link
Contributor

vadimcn commented Jan 4, 2014

@brson: I think I have a fix for Android. I still need to clean-up the patch, make sure tests still pass of other platforms and whatnot Do you want to hold off your C++ unwinding patch?

brson added a commit to brson/rust that referenced this issue Jan 4, 2014
For some reason using libunwind directly is not working.
@bors bors closed this as completed in 8990708 Jan 4, 2014
flip1995 pushed a commit to flip1995/rust that referenced this issue Jul 14, 2023
[`arithmetic_side_effect`]: allow different types on the right hand side for `Wrapping<T>`

Fixes rust-lang#11145

This lint has a list of allowed types, one of which is `Wrapping<T>`, but it was only actually allowed if the type on the right hand side was also `Wrapping<T>`, which meant that, for example, `Wrapping<u32> += u32` would still lint. It now allows binary ops involving `Wrapping<T>` regardless of the type on the rhs.
These impls have only existed since Rust 1.60.0, so that is probably why the lint was previously not handling this correctly

changelog: [`arithmetic_side_effect`]: allow different types on the right hand side for `Wrapping<T>` (e.g. `Wrapping<T> += T`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows A-testsuite Area: The testsuite used to check the correctness of rustc O-android Operating system: Android
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants