Skip to content

Include Linux atomic emulation on androideabi#423

Merged
Amanieu merged 1 commit into
masterfrom
unknown repository
May 31, 2021
Merged

Include Linux atomic emulation on androideabi#423
Amanieu merged 1 commit into
masterfrom
unknown repository

Conversation

@ghost

@ghost ghost commented May 31, 2021

Copy link
Copy Markdown

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

ghost commented Jun 1, 2021

Copy link
Copy Markdown
Author

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

@Amanieu

Amanieu commented Jun 1, 2021

Copy link
Copy Markdown
Member

Published 0.1.44.

@dcsommer

Copy link
Copy Markdown
Contributor

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

tgross35 pushed a commit that referenced this pull request Jan 31, 2026
Include Linux atomic emulation on androideabi
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.

2 participants