diff mbox series

[v2,6/7] lib/arm64/spinlock: Fix inline assembly for Clang

Message ID 20201001072234.143703-7-thuth@redhat.com (mailing list archive)
State New, archived
Headers show
Series Update travis CI | expand

Commit Message

Thomas Huth Oct. 1, 2020, 7:22 a.m. UTC
/home/travis/build/huth/kvm-unit-tests/lib/arm64/spinlock.c:29:12: error:
 value size does not match register size specified by the constraint and
 modifier [-Werror,-Wasm-operand-widths]
                : "=&r" (val), "=&r" (fail)
                         ^
/home/travis/build/huth/kvm-unit-tests/lib/arm64/spinlock.c:27:9: note: use
 constraint modifier "w"
                "       mov     %0, #1\n"
                                ^~
                                %w0

Use the "w" modifier as suggested to fix the issue.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 lib/arm64/spinlock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andrew Jones Oct. 1, 2020, 9:12 a.m. UTC | #1
On Thu, Oct 01, 2020 at 09:22:33AM +0200, Thomas Huth wrote:
> /home/travis/build/huth/kvm-unit-tests/lib/arm64/spinlock.c:29:12: error:
>  value size does not match register size specified by the constraint and
>  modifier [-Werror,-Wasm-operand-widths]
>                 : "=&r" (val), "=&r" (fail)
>                          ^
> /home/travis/build/huth/kvm-unit-tests/lib/arm64/spinlock.c:27:9: note: use
>  constraint modifier "w"
>                 "       mov     %0, #1\n"
>                                 ^~
>                                 %w0
> 
> Use the "w" modifier as suggested to fix the issue.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  lib/arm64/spinlock.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/arm64/spinlock.c b/lib/arm64/spinlock.c
> index fac4fc9..258303d 100644
> --- a/lib/arm64/spinlock.c
> +++ b/lib/arm64/spinlock.c
> @@ -24,7 +24,7 @@ void spin_lock(struct spinlock *lock)
>  		asm volatile(
>  		"1:	ldaxr	%w0, [%2]\n"
>  		"	cbnz	%w0, 1b\n"
> -		"	mov	%0, #1\n"
> +		"	mov	%w0, #1\n"
>  		"	stxr	%w1, %w0, [%2]\n"
>  		: "=&r" (val), "=&r" (fail)
>  		: "r" (&lock->v)
> -- 
> 2.18.2
>

Reviewed-by: Andrew Jones <drjones@redhat.com>
Tested-by: Andrew Jones <drjones@redhat.com>
diff mbox series

Patch

diff --git a/lib/arm64/spinlock.c b/lib/arm64/spinlock.c
index fac4fc9..258303d 100644
--- a/lib/arm64/spinlock.c
+++ b/lib/arm64/spinlock.c
@@ -24,7 +24,7 @@  void spin_lock(struct spinlock *lock)
 		asm volatile(
 		"1:	ldaxr	%w0, [%2]\n"
 		"	cbnz	%w0, 1b\n"
-		"	mov	%0, #1\n"
+		"	mov	%w0, #1\n"
 		"	stxr	%w1, %w0, [%2]\n"
 		: "=&r" (val), "=&r" (fail)
 		: "r" (&lock->v)