avr32: fix asm operand constraint in cmpxchg()
PATCH 1/1 avr32: fix asm operand constraint in cmpxchg()
If the 'old' operand to cmpxchg() is a constant wider than 21 bits, linking fails with a "relocation truncated to fit: R_AVR32_21S" error.
Fix this by replacing the "i" constraint with "Ks21" which makes the compiler use a temporary register for out of range constants.
---
This fixes link errors in linux-next with CONFIG_AIO_THREAD enabled.
--- arch/avr32/include/asm/cmpxchg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/avr32/include/asm/cmpxchg.h +1 -1
@@ -57,7 +57,7 @@ static inline unsigned long __cmpxchg_u32(volatile int *m, unsigned long old," brne 1b\n" "2:\n" : [ret] "=&r"(ret), [m] "=m"(*m) - : "m"(m), [old] "ir"(old), [new] "r"(new) + : "m"(m), [old] "Ks21r"(old), [new] "r"(new) : "memory", "cc"); return ret; }
Signature · 1 line
2.7.2
Quoted 9 lines · Mans Rullgard
If the 'old' operand to
cmpxchg()is a constant wider than 21 bits, linking fails with a "relocation truncated to fit:R_AVR32_21S" error.Fix this by replacing the "i" constraint with "Ks21" which makes the compiler use a temporary register for out of range constants.
Signed-off-by Mans Rullgard <[email protected]>---
This fixes link errors in linux-next withCONFIG_AIO_THREADenabled.
Good find, thank you for fixing.
I'll push this for next merge window.
Quoted 17 lines
--- arch/avr32/include/asm/cmpxchg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/avr32/include/asm/cmpxchg.h +1
-1@@ -57,7 +57,7 @@ static inline unsigned long __cmpxchg_u32(volatile int *m, unsigned long old," brne 1b\n" "2:\n" : [ret] "=&r"(ret), [m] "=m"(*m) - : "m"(m), [old] "ir"(old), [new] "r"(new) + : "m"(m), [old] "Ks21r"(old), [new] "r"(new) : "memory", "cc"); return ret; }
Signature · 2 lines
mvh Hans-Christian Egtvedt
Quoted 7 lines · Mans Rullgard
If the 'old' operand to
cmpxchg()is a constant wider than 21 bits, linking fails with a "relocation truncated to fit:R_AVR32_21S" error.Fix this by replacing the "i" constraint with "Ks21" which makes the compiler use a temporary register for out of range constants.
Signed-off-by Mans Rullgard <[email protected]>
Quoted 22 lines
---
This fixes link errors in linux-next withCONFIG_AIO_THREADenabled.--- arch/avr32/include/asm/cmpxchg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/avr32/include/asm/cmpxchg.h +1
-2@@ -57,7 +57,7 @@ static inline unsigned long __cmpxchg_u32(volatile int *m, unsigned long old," brne 1b\n" "2:\n" : [ret] "=&r"(ret), [m] "=m"(*m) - : "m"(m), [old] "ir"(old), [new] "r"(new) + : "m"(m), [old] "Ks21r"(old), [new] "r"(new) : "memory", "cc"); return ret; } --2.7.2
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 7 lines · Mans Rullgard
If the 'old' operand to
cmpxchg()is a constant wider than 21 bits, linking fails with a "relocation truncated to fit:R_AVR32_21S" error.Fix this by replacing the "i" constraint with "Ks21" which makes the compiler use a temporary register for out of range constants.
Signed-off-by Mans Rullgard <[email protected]>
build log at: https://gitlab.com/sudipm/linux-next/builds/839572
regards
sudip