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

Include Linux atomic emulation on androideabi #423

Merged
merged 1 commit into from May 31, 2021
Merged

Include Linux atomic emulation on androideabi #423

merged 1 commit into from May 31, 2021

Conversation

ghost
Copy link

@ghost ghost commented May 31, 2021

The old androideabi uses armv5 and thus also needs the atomic emulation and because Android is basically Linux it can use the same implementation.

This has been verified by taking a old libgcc from a ndk toolchain to a dissassembler:

__sync_fetch_and_add_4 as an example

00000000 <__sync_fetch_and_add_4>:
       0: f8 40 2d e9  	push	{r3, r4, r5, r6, r7, lr}
       4: 28 60 9f e5  	ldr	r6, [pc, #40]
       8: 00 50 a0 e1  	mov	r5, r0
       c: 01 70 a0 e1  	mov	r7, r1
      10: 00 40 95 e5  	ldr	r4, [r5]
      14: 05 20 a0 e1  	mov	r2, r5
      18: 04 00 a0 e1  	mov	r0, r4
      1c: 07 10 84 e0  	add	r1, r4, r7
      20: 36 ff 2f e1  	blx	r6
      24: 00 00 50 e3  	cmp	r0, #0
      28: f8 ff ff 1a  	bne	#-32 <__sync_fetch_and_add_4+0x10>
      2c: 04 00 a0 e1  	mov	r0, r4
      30: f8 80 bd e8  	pop	{r3, r4, r5, r6, r7, pc}

00000034 <$d>:
      34:	c0 0f ff ff	.word	0xffff0fc0

0xffff0fc0 being the address of the kuser function kuser_cmpxchg.

Reason for this change: rust-lang/rust#85806 (comment)

The old androideabi uses armv5 and thus also needs the atomic emulation
and because Android is basically Linux it can use the same
implementation.
@Amanieu Amanieu merged commit 2956079 into rust-lang:master May 31, 2021
@ghost
Copy link
Author

ghost commented Jun 1, 2021

Would you mind publishing a new version, so that these changes can be included in the rust repository?

@Amanieu
Copy link
Member

Amanieu commented Jun 1, 2021

Published 0.1.44.

@dcsommer
Copy link
Contributor

@ATiltedTree just a heads up this was partially reverted in #450

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants