rust-lang / miri

An interpreter for Rust's mid-level intermediate representation
Apache License 2.0
4.16k stars 318 forks source link

Complete basic support for android #3608

Closed RalfJung closed 1 month ago

RalfJung commented 1 month ago

The goal is to get this command to pass:

./miri test --target aarch64-linux-android empty_main integer vec string btreemap hello hashmap heap_alloc align

I think all that's missing is

devnexen commented 1 month ago

maybe, like it s been done with illumos, we might not need to bother with memalign but using posix_memalign instead (android api 16/17 min. I believe).

RalfJung commented 1 month ago

Good point. Our target page says

Rust will support the most recent Long Term Support (LTS) Android Native Development Kit (NDK). By default Rust will support all API levels supported by the NDK, but a higher minimum API level may be required if deemed necessary.

I don't know what concretely that means for our current minimum API level. The current LTS version seems to be r26d, and according to this the minimum API level supported there is 21 -- so if posix_memalign is indeed in 16 or 17 we should be able to use it.

@chriswailes do you think we can switch the Rust allocator to posix_memalign on Android and use the common code path that most Unixes use? It's always nice to cut down on exceptions. :) And also it'd be less work for Miri to support Android, then. ;)

RalfJung commented 1 month ago

I opened a PR to use posix_memalign on Android: https://github.com/rust-lang/rust/pull/125244