diff mbox series

[uclibc-ng-devel,2/2] linuxthread/arm: Unlock ldrex/strex varsion of testandset for __ARM_ARCH >= 7

Message ID 20220718115724.13051-2-vladimir.murzin@arm.com
State Accepted
Headers show
Series [uclibc-ng-devel,1/2] linuxthreads/arm: fix ldrex/strex loop when built with O0 | expand

Commit Message

Vladimir Murzin July 18, 2022, 11:57 a.m. UTC
Thomas has repored failure building ARM 32-bit systems for ARMv8 cores

  CC libpthread/linuxthreads/mutex.os
/tmp/ccn8SFKU.s: Assembler messages:
/tmp/ccn8SFKU.s:162: Error: swp{b} use is obsoleted for ARMv8 and later
/tmp/ccn8SFKU.s:186: Error: swp{b} use is obsoleted for ARMv8 and later
/tmp/ccn8SFKU.s:203: Error: swp{b} use is obsoleted for ARMv8 and later
/tmp/ccn8SFKU.s:224: Error: swp{b} use is obsoleted for ARMv8 and later
make[1]: *** [Makerules:369: libpthread/linuxthreads/mutex.os] Error 1

This is due to libpthread/linuxthreads/sysdeps/arm/pt-machine.h which
uses the swp instruction that is not allowed on ARMv8.

All __ARM_ARCH >= 7 support ldrex/strex instructions, so unlock
testandset() varaint for them.

Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
---
 libpthread/linuxthreads/sysdeps/arm/pt-machine.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libpthread/linuxthreads/sysdeps/arm/pt-machine.h b/libpthread/linuxthreads/sysdeps/arm/pt-machine.h
index b00b10495..3250961cf 100644
--- a/libpthread/linuxthreads/sysdeps/arm/pt-machine.h
+++ b/libpthread/linuxthreads/sysdeps/arm/pt-machine.h
@@ -28,7 +28,7 @@ 
 # define PT_EI __extern_always_inline
 #endif
 
-#if defined(__thumb2__)
+#if  __ARM_ARCH >= 7 || defined(__thumb2__)
 /* Spinlock implementation; required.  */
 PT_EI long int
 testandset (int *spinlock)