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

NEON instructions presents in jemalloc for Armv7 android #48207

Closed
kali opened this issue Feb 14, 2018 · 2 comments
Closed

NEON instructions presents in jemalloc for Armv7 android #48207

kali opened this issue Feb 14, 2018 · 2 comments
Labels
C-bug Category: This is a bug. O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@kali
Copy link
Contributor

kali commented Feb 14, 2018

Armv7 android spec do not ensure NEON support, even if most actual devices have it. The simulator does not support the extensions.

When running rust executable in the android emulator, jemalloc triggers Invalid instructions errors as its code contains vmov.i32 (among others) instructions.

  64cdc:    0a0000c6     beq    64ffc <je_tcache_boot+0x3d4>
  64ce0:    e59f1394     ldr    r1, [pc, #916]    ; 6507c <je_tcache_boot+0x454>
  64ce4:    f2c12055     vmov.i32    q9, #21    ; 0x00000015
  64ce8:    f3c44058     vmov.i32    q10, #200    ; 0x000000c8
  64cec:    e3a07000     mov    r7, #0
  64cf0:    f2c16054     vmov.i32    q11, #20    ; 0x00000014
  64cf4:    e3a050c8     mov    r5, #200    ; 0xc8
  64cf8:    e79f1001     ldr    r1, [pc, r1]
  64cfc:    e2812080     add    r2, r1, #128    ; 0x80
  64d00:    e2813e16     add    r3, r1, #352    ; 0x160

This issue is only visible when 1/ running a rust binary (as in, not a library) and 2/ on the simulator or one of the very rare devices that do not actually have support.

to reproduce:

avdmanager create avd -n test -k "system-images;android-21;google_apis;armeabi-v7a"
$ANDROID_SDK_ROOT/emulator/emulator @test
TC=path/to/toolchain
echo "fn main(){}" | rustc -Clinker=$TC/bin/arm-linux-androideabi-gcc --target armv7-linux-androideabi -o foo -
$ANDROID_SDK_ROOT/platform-tools/adb push foo /data/local/tmp/foo
$ANDROID_SDK_ROOT/platform-tools/adb shell /data/local/tmp/foo

adb logcat should point to a tombstone...

backtrace:
    #00 pc 0003e5b4  /data/local/tmp/foo
    #01 pc 000292d8  /data/local/tmp/foo

invalid op:

$TC/bin/arm-linux-androideabi-objdump -d foo | grep 3e5b4
   3e5b4:	f2c12055 	vmov.i32	q9, #21	; 0x00000015

We know for sure that this code comes from jemalloc, but we suspect at last backtrace contains some NEON instructions has well. (we grepped vmov in objdump output, and some functions (like read_attribute) containing them come from backtrace.

@kennytm kennytm added O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) and removed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 14, 2018
@mattico
Copy link
Contributor

mattico commented Feb 14, 2018

#38413 disabled neon for android targets in rust, but that didn't help for C dependencies.

I think the place to fix this is in cc-rs, here:

https://github.com/alexcrichton/cc-rs/blob/a00c415929156aeba5485d7dee27f8fe1d1a69bf/src/lib.rs#L1138-L1145

which should use -march=armv7-a+nosimd. I assume that bootstrap doesn't override this behavior somewhere...

@alexcrichton
Copy link
Member

Jemalloc was removed in #55238 so closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

No branches or pull requests

4 participants