Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1355157 > unrolled thread

[PATCH] avr32: fix asm operand constraint in cmpxchg()

Started byMans Rullgard <mans@mansr.com>
First post2016-03-10 15:30 +0100
Last post2016-03-10 18:50 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] avr32: fix asm operand constraint in cmpxchg() Mans Rullgard <mans@mansr.com> - 2016-03-10 15:30 +0100
    Re: [PATCH] avr32: fix asm operand constraint in cmpxchg() Andy Shevchenko <andy.shevchenko@gmail.com> - 2016-03-10 16:30 +0100
    Re: [PATCH] avr32: fix asm operand constraint in cmpxchg() Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2016-03-10 18:50 +0100

#1355157 — [PATCH] avr32: fix asm operand constraint in cmpxchg()

FromMans Rullgard <mans@mansr.com>
Date2016-03-10 15:30 +0100
Subject[PATCH] avr32: fix asm operand constraint in cmpxchg()
Message-ID<rb9Lc-89a-15@gated-at.bofh.it>
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 <mans@mansr.com>
---
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(-)

diff --git a/arch/avr32/include/asm/cmpxchg.h b/arch/avr32/include/asm/cmpxchg.h
index 366bbeaeb405..572739b4c4b4 100644
--- a/arch/avr32/include/asm/cmpxchg.h
+++ b/arch/avr32/include/asm/cmpxchg.h
@@ -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

[toc] | [next] | [standalone]


#1355198

FromAndy Shevchenko <andy.shevchenko@gmail.com>
Date2016-03-10 16:30 +0100
Message-ID<rbaHg-q8-7@gated-at.bofh.it>
In reply to#1355157
On Thu, Mar 10, 2016 at 4:23 PM, Mans Rullgard <mans@mansr.com> wrote:
> 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 <mans@mansr.com>

Tested-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> ---
> 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(-)
>
> diff --git a/arch/avr32/include/asm/cmpxchg.h b/arch/avr32/include/asm/cmpxchg.h
> index 366bbeaeb405..572739b4c4b4 100644
> --- a/arch/avr32/include/asm/cmpxchg.h
> +++ b/arch/avr32/include/asm/cmpxchg.h
> @@ -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
>



-- 
With Best Regards,
Andy Shevchenko

[toc] | [prev] | [next] | [standalone]


#1355287

FromSudip Mukherjee <sudipm.mukherjee@gmail.com>
Date2016-03-10 18:50 +0100
Message-ID<rbcSM-1Wa-29@gated-at.bofh.it>
In reply to#1355157
On Thursday 10 March 2016 07:53 PM, Mans Rullgard wrote:
> 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 <mans@mansr.com>

build log at: https://gitlab.com/sudipm/linux-next/builds/839572

Tested-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>

regards
sudip

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web